diff -uN local-orig/netperf-2.1pl2/netlib.c local-new/netperf-2.1pl2/netlib.c
--- local-orig/netperf-2.1pl2/netlib.c
+++ local-new/netperf-2.1pl2/netlib.c
@@ -1285,7 +1285,7 @@
     dump_request();
 
     fprintf(where,
-	    "\nsend_request: about to send %ld bytes from %p\n",
+	    "\nsend_request: about to send %d bytes from %p\n",
 	    sizeof(netperf_request),
 	    &netperf_request);
     fflush(where);
@@ -2785,7 +2785,7 @@
   /* program, but that doesn't really seem worthwhile - raj 4/95 */
   if (debug > 1) {
     fprintf(where,
-	    "Looper child %d is born, pid %d\n",
+	    "Looper child %d is born, pid %ld\n",
 	    child_index,
 	    getpid());
     fflush(where);
diff -uN local-orig/netperf-2.1pl2/netlib.h local-new/netperf-2.1pl2/netlib.h
--- local-orig/netperf-2.1pl2/netlib.h
+++ local-new/netperf-2.1pl2/netlib.h
@@ -262,6 +262,7 @@
 extern  int     dl_open();
 extern  char    format_cpu_method();
 extern unsigned int convert();
+extern  int     delta_micro();
 
  /* these are all for the confidence interval stuff */
 extern double confidence;
@@ -274,6 +275,11 @@
 #define HAVE_BCOPY
 #define HAVE_BZERO
 #endif
+
+#if defined(__FreeBSD__) || defined(__NetBSD__)
+#define	HAVE_BCOPY
+#define	HAVE_BZERO
+#endif	/* __FreeBSD__ || __NetBSD__ */
 
 #ifndef HAVE_BCOPY
 #define bcopy(s,d,h) memcpy((d),(s),(h))
diff -uN local-orig/netperf-2.1pl2/netserver.c local-new/netperf-2.1pl2/netserver.c
--- local-orig/netperf-2.1pl2/netserver.c
+++ local-new/netperf-2.1pl2/netserver.c
@@ -405,7 +405,7 @@
       fclose(stdin);
       fclose(stderr);
  /* can I just use setsid on all systems? raj 4/96 */
-#if defined(__NetBSD__) || defined(__bsdi__) || defined(sun) || defined(__FREEBSD__)
+#if defined(__NetBSD__) || defined(__bsdi__) || defined(sun) || defined(__FreeBSD__)
       setsid();
 #else
       setpgrp();
diff -uN local-orig/netperf-2.1pl2/netsh.h local-new/netperf-2.1pl2/netsh.h
--- local-orig/netperf-2.1pl2/netsh.h
+++ local-new/netperf-2.1pl2/netsh.h
@@ -28,7 +28,7 @@
 #define 	REM_SEND_ALIGN	4	/* alignment for remote sends	*/
 
 /* misc defines for the hell of it					*/
-#define 	MAXLONG  	4294967295L
+#define 	MAXLONG  	4294967295LU
 
 #ifndef NETSH
 /* stuff to say where this test is going                                */
diff -uN local-orig/netperf-2.1pl2/nettest_bsd.c local-new/netperf-2.1pl2/nettest_bsd.c
--- local-orig/netperf-2.1pl2/nettest_bsd.c
+++ local-new/netperf-2.1pl2/nettest_bsd.c
@@ -54,6 +54,7 @@
 #include <netinet/in.h>
 #include <netinet/tcp.h>
 #include <netdb.h>
+#include <sys/param.h>
 #else /* WIN32 */
 #include <process.h>
 #include <windows.h>
@@ -64,6 +65,11 @@
 #include "netlib.h"
 #include "netsh.h"
 #include "nettest_bsd.h"
+
+#ifdef	BSD
+#include <sys/time.h>
+#include <arpa/inet.h>
+#endif	/* BSD */
 
 #ifdef HISTOGRAM
 #include "hist.h"
diff -uN local-orig/netperf-2.1pl2/nettest_ipv6.c local-new/netperf-2.1pl2/nettest_ipv6.c
--- local-orig/netperf-2.1pl2/nettest_ipv6.c
+++ local-new/netperf-2.1pl2/nettest_ipv6.c
@@ -43,7 +43,9 @@
 #include <stdio.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#ifdef HP
 #include <netinet6/in6.h>
+#endif
 #include <netinet/tcp.h>
 #include <netdb.h>
 #include <string.h>
@@ -53,6 +55,9 @@
 #else /* NOSTDLIBH */
 #include <stdlib.h>
 #endif /* NOSTDLIBH */
+#include <sys/time.h>
+#include <unistd.h>
+#include <resolv.h>
 
 #include "netlib.h"
 #include "netsh.h"
@@ -465,11 +470,11 @@
   struct	tcpipv6_stream_results_struct	*tcpipv6_stream_result;
   
   tcpipv6_stream_request  = 
-    (struct tcpipv6_stream_request_struct *)netperf_request.test_specific_data;
+    (struct tcpipv6_stream_request_struct *)netperf_request.content.test_specific_data;
   tcpipv6_stream_response =
-    (struct tcpipv6_stream_response_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_stream_response_struct *)netperf_response.content.test_specific_data;
   tcpipv6_stream_result   = 
-    (struct tcpipv6_stream_results_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_stream_results_struct *)netperf_response.content.test_specific_data;
   
 #ifdef HISTOGRAM
   time_hist = HIST_new();
@@ -490,11 +495,14 @@
       fflush(where);
     }
   }
-  if ((hp = hostname2addr(remote_host,AF_INET6)) == NULL) {
+  (void)res_init();
+  _res.options |= RES_USE_INET6;
+  if ((hp = gethostbyname(remote_host)) == NULL) {
     fprintf(where,
 	    "send_tcpipv6_stream: could not resolve the name %s\n",
 	    remote_host);
     fflush(where);
+    exit(1);
   }
   
   bcopy(hp->h_addr,
@@ -632,7 +640,7 @@
     /* default should be used. Alignment is the exception, it will */
     /* default to 1, which will be no alignment alterations. */
     
-    netperf_request.request_type	=	DO_TCPIPV6_STREAM;
+    netperf_request.content.request_type	=	DO_TCPIPV6_STREAM;
     tcpipv6_stream_request->send_buf_size	=	rss_size;
     tcpipv6_stream_request->recv_buf_size	=	rsr_size;
     tcpipv6_stream_request->receive_size	=	recv_size;
@@ -674,7 +682,7 @@
     
     recv_response();
     
-    if (!netperf_response.serv_errno) {
+    if (!netperf_response.content.serv_errno) {
       if (debug)
 	fprintf(where,"remote listen done.\n");
       rsr_size	      =	tcpipv6_stream_response->recv_buf_size;
@@ -691,7 +699,7 @@
       rem_sndavoid	= tcpipv6_stream_response->so_sndavoid;
     }
     else {
-      errno = netperf_response.serv_errno;
+      errno = netperf_response.content.serv_errno;
       perror("netperf: remote error");
       
       exit(1);
@@ -892,12 +900,12 @@
     /* wasn't supposed to care, it will return obvious values. */
     
     recv_response();
-    if (!netperf_response.serv_errno) {
+    if (!netperf_response.content.serv_errno) {
       if (debug)
 	fprintf(where,"remote results obtained\n");
     }
     else {
-      errno = netperf_response.serv_errno;
+      errno = netperf_response.content.serv_errno;
       perror("netperf: remote error");
       
       exit(1);
@@ -941,7 +949,7 @@
 	remote_service_demand	= calc_service_demand(bytes_sent,
 						      0.0,
 						      remote_cpu_utilization,
-						      tcp_ipv6_stream_result->num_cpus);
+						      tcpipv6_stream_result->num_cpus);
       }
       else {
 	remote_cpu_utilization = -1.0;
@@ -1145,11 +1153,11 @@
   struct	tcpipv6_stream_results_struct	*tcpipv6_stream_results;
   
   tcpipv6_stream_request	= 
-    (struct tcpipv6_stream_request_struct *)netperf_request.test_specific_data;
+    (struct tcpipv6_stream_request_struct *)netperf_request.content.test_specific_data;
   tcpipv6_stream_response	= 
-    (struct tcpipv6_stream_response_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_stream_response_struct *)netperf_response.content.test_specific_data;
   tcpipv6_stream_results	= 
-    (struct tcpipv6_stream_results_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_stream_results_struct *)netperf_response.content.test_specific_data;
   
   if (debug) {
     fprintf(where,"netserver: recv_tcpipv6_stream: entered...\n");
@@ -1174,7 +1182,7 @@
     fflush(where);
   }
   
-  netperf_response.response_type = TCPIPV6_STREAM_RESPONSE;
+  netperf_response.content.response_type = TCPIPV6_STREAM_RESPONSE;
   
   if (debug) {
     fprintf(where,"recv_tcpipv6_stream: the response type is set...\n");
@@ -1230,7 +1238,7 @@
 	      "recv_tcpipv6_stream: unable to grab a socket\n");
       fflush(where);
     }
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     send_response();
     exit(1);
   }
@@ -1250,7 +1258,7 @@
 	      errno);
       fflush(where);
     }
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     
@@ -1294,7 +1302,7 @@
   
   /* Now, let's set-up the socket to listen for connections */
   if (listen(s_listen, 5) == -1) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     
@@ -1307,7 +1315,7 @@
   if (getsockname(s_listen, 
 		  (struct sockaddr *)&myaddr_in,
 		  &addrlen) == -1){
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     
@@ -1319,7 +1327,7 @@
   /* socket buffer sizing has been done. */
   
   tcpipv6_stream_response->data_port_number = (int) ntohs(myaddr_in.sin6_port);
-  netperf_response.serv_errno   = 0;
+  netperf_response.content.serv_errno   = 0;
   
   /* But wait, there's more. If the initiator wanted cpu measurements, */
   /* then we must call the calibrate routine, which will return the max */
@@ -1390,7 +1398,7 @@
 
   while ((len = recv(s_data, recv_ring->buffer_ptr, recv_size, 0)) != 0) {
     if (len < 0) {
-      netperf_response.serv_errno = errno;
+      netperf_response.content.serv_errno = errno;
       send_response();
       exit(1);
     }
@@ -1417,7 +1425,7 @@
   /* we have received all the data sent. raj 4/93 */
 
   if (shutdown(s_data,1) == -1) {
-      netperf_response.serv_errno = errno;
+      netperf_response.content.serv_errno = errno;
       send_response();
       exit(1);
     }
@@ -1458,6 +1466,7 @@
   }
   
   tcpipv6_stream_results->cpu_method = cpu_method;
+  tcpipv6_stream_results->num_cpus   = lib_num_loc_cpus;
   send_response();
 
   /* we are now done with the sockets */
@@ -1546,11 +1555,11 @@
 #endif /* INTERVALS */
 
   tcpipv6_rr_request = 
-    (struct tcpipv6_rr_request_struct *)netperf_request.test_specific_data;
+    (struct tcpipv6_rr_request_struct *)netperf_request.content.test_specific_data;
   tcpipv6_rr_response=
-    (struct tcpipv6_rr_response_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_rr_response_struct *)netperf_response.content.test_specific_data;
   tcpipv6_rr_result	=
-    (struct tcpipv6_rr_results_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_rr_results_struct *)netperf_response.content.test_specific_data;
   
 #ifdef HISTOGRAM
   time_hist = HIST_new();
@@ -1572,11 +1581,14 @@
       fflush(where);
     }
   }
-  if ((hp = hostname2addr(remote_host,AF_INET6)) == NULL) {
+  (void)res_init();
+  _res.options |= RES_USE_INET6;
+  if ((hp = gethostbyname(remote_host)) == NULL) {
     fprintf(where,
 	    "send_tcpipv6_rr: could not resolve the name %s\n",
 	    remote_host);
     fflush(where);
+    exit(1);
   }
   
   bcopy(hp->h_addr,
@@ -1698,7 +1710,7 @@
     /* default should be used. Alignment is the exception, it will */
     /* default to 8, which will be no alignment alterations. */
     
-    netperf_request.request_type	=	DO_TCPIPV6_RR;
+    netperf_request.content.request_type	=	DO_TCPIPV6_RR;
     tcpipv6_rr_request->recv_buf_size	=	rsr_size;
     tcpipv6_rr_request->send_buf_size	=	rss_size;
     tcpipv6_rr_request->recv_alignment      =	remote_recv_align;
@@ -1737,7 +1749,7 @@
   
     recv_response();
   
-    if (!netperf_response.serv_errno) {
+    if (!netperf_response.content.serv_errno) {
       if (debug)
 	fprintf(where,"remote listen done.\n");
       rsr_size          = tcpipv6_rr_response->recv_buf_size;
@@ -1750,7 +1762,7 @@
       server.sin6_port   = htons(server.sin6_port);
     }
     else {
-      errno = netperf_response.serv_errno;
+      errno = netperf_response.content.serv_errno;
       perror("netperf: remote error");
       
       exit(1);
@@ -1931,12 +1943,12 @@
     /* wasn't supposed to care, it will return obvious values. */
     
     recv_response();
-    if (!netperf_response.serv_errno) {
+    if (!netperf_response.content.serv_errno) {
       if (debug)
 	fprintf(where,"remote results obtained\n");
     }
     else {
-      errno = netperf_response.serv_errno;
+      errno = netperf_response.content.serv_errno;
       perror("netperf: remote error");
       
       exit(1);
@@ -2220,11 +2232,11 @@
   struct	udpipv6_stream_results_struct	*udpipv6_stream_results;
   
   udpipv6_stream_request	= 
-    (struct udpipv6_stream_request_struct *)netperf_request.test_specific_data;
+    (struct udpipv6_stream_request_struct *)netperf_request.content.test_specific_data;
   udpipv6_stream_response	= 
-    (struct udpipv6_stream_response_struct *)netperf_response.test_specific_data;
+    (struct udpipv6_stream_response_struct *)netperf_response.content.test_specific_data;
   udpipv6_stream_results	= 
-    (struct udpipv6_stream_results_struct *)netperf_response.test_specific_data;
+    (struct udpipv6_stream_results_struct *)netperf_response.content.test_specific_data;
   
 #ifdef HISTOGRAM
   time_hist = HIST_new();
@@ -2246,11 +2258,14 @@
       fflush(where);
     }
   }
-  if ((hp = hostname2addr(remote_host,AF_INET6)) == NULL) {
+  (void)res_init();
+  _res.options |= RES_USE_INET6;
+  if ((hp = gethostbyname(remote_host)) == NULL) {
     fprintf(where,
 	    "send_udpipv6_stream: could not resolve the name %s\n",
 	    remote_host);
     fflush(where);
+    exit(1);
   }
   
   bcopy(hp->h_addr,
@@ -2363,7 +2378,7 @@
     /* Of course this is a datagram service so no connection is actually */
     /* set up, the server just sets up the socket and binds it. */
     
-    netperf_request.request_type      = DO_UDPIPV6_STREAM;
+    netperf_request.content.request_type      = DO_UDPIPV6_STREAM;
     udpipv6_stream_request->recv_buf_size  = rsr_size;
     udpipv6_stream_request->message_size   = send_size;
     udpipv6_stream_request->recv_alignment = remote_recv_align;
@@ -2378,12 +2393,12 @@
     
     recv_response();
     
-    if (!netperf_response.serv_errno) {
+    if (!netperf_response.content.serv_errno) {
       if (debug)
 	fprintf(where,"send_udpipv6_stream: remote data connection done.\n");
     }
     else {
-      errno = netperf_response.serv_errno;
+      errno = netperf_response.content.serv_errno;
       perror("send_udpipv6_stream: error on remote");
       exit(1);
     }
@@ -2540,12 +2555,12 @@
     
     /* Get the statistics from the remote end	*/
     recv_response();
-    if (!netperf_response.serv_errno) {
+    if (!netperf_response.content.serv_errno) {
       if (debug)
 	fprintf(where,"send_udpipv6_stream: remote results obtained\n");
     }
     else {
-      errno = netperf_response.serv_errno;
+      errno = netperf_response.content.serv_errno;
       perror("send_udpipv6_stream: error on remote");
       exit(1);
     }
@@ -2778,11 +2793,11 @@
   struct	udpipv6_stream_results_struct	*udpipv6_stream_results;
   
   udpipv6_stream_request  = 
-    (struct udpipv6_stream_request_struct *)netperf_request.test_specific_data;
+    (struct udpipv6_stream_request_struct *)netperf_request.content.test_specific_data;
   udpipv6_stream_response = 
-    (struct udpipv6_stream_response_struct *)netperf_response.test_specific_data;
+    (struct udpipv6_stream_response_struct *)netperf_response.content.test_specific_data;
   udpipv6_stream_results  = 
-    (struct udpipv6_stream_results_struct *)netperf_response.test_specific_data;
+    (struct udpipv6_stream_results_struct *)netperf_response.content.test_specific_data;
   
   if (debug) {
     fprintf(where,"netserver: recv_udpipv6_stream: entered...\n");
@@ -2807,7 +2822,7 @@
     fflush(where);
   }
   
-  netperf_response.response_type = UDPIPV6_STREAM_RESPONSE;
+  netperf_response.content.response_type = UDPIPV6_STREAM_RESPONSE;
   
   if (debug > 2) {
     fprintf(where,"recv_udpipv6_stream: the response type is set...\n");
@@ -2868,7 +2883,7 @@
 			      SOCK_DGRAM);
   
   if (s_data < 0) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     send_response();
     exit(1);
   }
@@ -2882,7 +2897,7 @@
   if (bind(s_data,
 	   (struct sockaddr *)&myaddr_in,
 	   sizeof(myaddr_in)) == -1) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     send_response();
     exit(1);
   }
@@ -2894,7 +2909,7 @@
   if (getsockname(s_data, 
 		  (struct sockaddr *)&myaddr_in,
 		  &addrlen) == -1){
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_data);
     send_response();
     
@@ -2906,7 +2921,7 @@
   /* socket buffer sizing has been done. */
   
   udpipv6_stream_response->data_port_number = (int) ntohs(myaddr_in.sin6_port);
-  netperf_response.serv_errno   = 0;
+  netperf_response.content.serv_errno   = 0;
   
   /* But wait, there's more. If the initiator wanted cpu measurements, */
   /* then we must call the calibrate routine, which will return the max */
@@ -2960,7 +2975,7 @@
 		    message_size, 
 		    0)) != message_size) {
       if ((len == -1) && (errno != EINTR)) {
-	netperf_response.serv_errno = errno;
+	netperf_response.content.serv_errno = errno;
 	send_response();
 	exit(1);
       }
@@ -3006,11 +3021,12 @@
     fflush(where);
   }
   
-  netperf_response.response_type	= UDPIPV6_STREAM_RESULTS;
+  netperf_response.content.response_type	= UDPIPV6_STREAM_RESULTS;
   udpipv6_stream_results->bytes_received	= htond(bytes_received);
   udpipv6_stream_results->messages_recvd	= messages_recvd;
   udpipv6_stream_results->elapsed_time	= elapsed_time;
   udpipv6_stream_results->cpu_method        = cpu_method;
+  udpipv6_stream_results->num_cpus          = lib_num_loc_cpus;
   if (udpipv6_stream_request->measure_cpu) {
     udpipv6_stream_results->cpu_util	= calc_cpu_util(elapsed_time);
   }
@@ -3097,11 +3113,11 @@
 #endif /* INTERVALS */
   
   udpipv6_rr_request  =
-    (struct udpipv6_rr_request_struct *)netperf_request.test_specific_data;
+    (struct udpipv6_rr_request_struct *)netperf_request.content.test_specific_data;
   udpipv6_rr_response =
-    (struct udpipv6_rr_response_struct *)netperf_response.test_specific_data;
+    (struct udpipv6_rr_response_struct *)netperf_response.content.test_specific_data;
   udpipv6_rr_result	 =
-    (struct udpipv6_rr_results_struct *)netperf_response.test_specific_data;
+    (struct udpipv6_rr_results_struct *)netperf_response.content.test_specific_data;
   
 #ifdef HISTOGRAM
   time_hist = HIST_new();
@@ -3123,11 +3139,14 @@
       fflush(where);
     }
   }
-  if ((hp = hostname2addr(remote_host,AF_INET6)) == NULL) {
+  (void)res_init();
+  _res.options |= RES_USE_INET6;
+  if ((hp = gethostbyname(remote_host)) == NULL) {
     fprintf(where,
 	    "send_udpipv6_rr: could not resolve the name %s\n",
 	    remote_host);
     fflush(where);
+    exit(1);
   }
   
   bcopy(hp->h_addr,
@@ -3245,7 +3264,7 @@
     /* default should be used. Alignment is the exception, it will */
     /* default to 8, which will be no alignment alterations. */
     
-    netperf_request.request_type	= DO_UDPIPV6_RR;
+    netperf_request.content.request_type	= DO_UDPIPV6_RR;
     udpipv6_rr_request->recv_buf_size	= rsr_size;
     udpipv6_rr_request->send_buf_size	= rss_size;
     udpipv6_rr_request->recv_alignment      = remote_recv_align;
@@ -3283,7 +3302,7 @@
     
     recv_response();
     
-    if (!netperf_response.serv_errno) {
+    if (!netperf_response.content.serv_errno) {
       if (debug)
 	fprintf(where,"remote listen done.\n");
       rsr_size	       =	udpipv6_rr_response->recv_buf_size;
@@ -3295,7 +3314,7 @@
       server.sin6_port  = 	htons(server.sin6_port);
     }
     else {
-      errno = netperf_response.serv_errno;
+      errno = netperf_response.content.serv_errno;
       perror("netperf: remote error");
       
       exit(1);
@@ -3474,12 +3493,12 @@
     /* it wasn't supposed to care, it will return obvious values. */
     
     recv_response();
-    if (!netperf_response.serv_errno) {
+    if (!netperf_response.content.serv_errno) {
       if (debug)
 	fprintf(where,"remote results obtained\n");
     }
     else {
-      errno = netperf_response.serv_errno;
+      errno = netperf_response.content.serv_errno;
       perror("netperf: remote error");
       
       exit(1);
@@ -3715,11 +3734,11 @@
   struct	udpipv6_rr_results_struct	*udpipv6_rr_results;
   
   udpipv6_rr_request  = 
-    (struct udpipv6_rr_request_struct *)netperf_request.test_specific_data;
+    (struct udpipv6_rr_request_struct *)netperf_request.content.test_specific_data;
   udpipv6_rr_response = 
-    (struct udpipv6_rr_response_struct *)netperf_response.test_specific_data;
+    (struct udpipv6_rr_response_struct *)netperf_response.content.test_specific_data;
   udpipv6_rr_results  = 
-    (struct udpipv6_rr_results_struct *)netperf_response.test_specific_data;
+    (struct udpipv6_rr_results_struct *)netperf_response.content.test_specific_data;
   
   if (debug) {
     fprintf(where,"netserver: recv_udpipv6_rr: entered...\n");
@@ -3744,7 +3763,7 @@
     fflush(where);
   }
   
-  netperf_response.response_type = UDPIPV6_RR_RESPONSE;
+  netperf_response.content.response_type = UDPIPV6_RR_RESPONSE;
   
   if (debug) {
     fprintf(where,"recv_udpipv6_rr: the response type is set...\n");
@@ -3817,7 +3836,7 @@
 			      SOCK_DGRAM);
   
   if (s_data < 0) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     send_response();
     
     exit(1);
@@ -3832,7 +3851,7 @@
   if (bind(s_data,
 	   (struct sockaddr *)&myaddr_in,
 	   sizeof(myaddr_in)) == -1) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_data);
     send_response();
     
@@ -3844,7 +3863,7 @@
   if (getsockname(s_data, 
 		  (struct sockaddr *)&myaddr_in,
 		  &addrlen) == -1){
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_data);
     send_response();
     
@@ -3856,7 +3875,7 @@
   /* socket buffer sizing has been done. */
   
   udpipv6_rr_response->data_port_number = (int) ntohs(myaddr_in.sin6_port);
-  netperf_response.serv_errno   = 0;
+  netperf_response.content.serv_errno   = 0;
   
   fprintf(where,"recv port number %d\n",myaddr_in.sin6_port);
   fflush(where);
@@ -3917,7 +3936,7 @@
 	/* we must have hit the end of test time. */
 	break;
       }
-      netperf_response.serv_errno = errno;
+      netperf_response.content.serv_errno = errno;
       send_response();
       exit(1);
     }
@@ -3934,7 +3953,7 @@
 	/* we have hit end of test time. */
 	break;
       }
-      netperf_response.serv_errno = errno;
+      netperf_response.content.serv_errno = errno;
       send_response();
       exit(1);
     }
@@ -3981,6 +4000,7 @@
   udpipv6_rr_results->trans_received = trans_received;
   udpipv6_rr_results->elapsed_time	 = elapsed_time;
   udpipv6_rr_results->cpu_method     = cpu_method;
+  udpipv6_rr_results->num_cpus       = lib_num_loc_cpus;
   if (udpipv6_rr_request->measure_cpu) {
     udpipv6_rr_results->cpu_util	= calc_cpu_util(elapsed_time);
   }
@@ -4025,11 +4045,11 @@
   struct	tcpipv6_rr_results_struct	*tcpipv6_rr_results;
   
   tcpipv6_rr_request = 
-    (struct tcpipv6_rr_request_struct *)netperf_request.test_specific_data;
+    (struct tcpipv6_rr_request_struct *)netperf_request.content.test_specific_data;
   tcpipv6_rr_response =
-    (struct tcpipv6_rr_response_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_rr_response_struct *)netperf_response.content.test_specific_data;
   tcpipv6_rr_results =
-    (struct tcpipv6_rr_results_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_rr_results_struct *)netperf_response.content.test_specific_data;
   
   if (debug) {
     fprintf(where,"netserver: recv_tcpipv6_rr: entered...\n");
@@ -4054,7 +4074,7 @@
     fflush(where);
   }
   
-  netperf_response.response_type = TCPIPV6_RR_RESPONSE;
+  netperf_response.content.response_type = TCPIPV6_RR_RESPONSE;
   
   if (debug) {
     fprintf(where,"recv_tcpipv6_rr: the response type is set...\n");
@@ -4123,7 +4143,7 @@
 				SOCK_STREAM);
   
   if (s_listen < 0) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     send_response();
     
     exit(1);
@@ -4138,7 +4158,7 @@
   if (bind(s_listen,
 	   (struct sockaddr *)&myaddr_in,
 	   sizeof(myaddr_in)) == -1) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     
@@ -4147,7 +4167,7 @@
   
   /* Now, let's set-up the socket to listen for connections */
   if (listen(s_listen, 5) == -1) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     
@@ -4159,7 +4179,7 @@
   addrlen = sizeof(myaddr_in);
   if (getsockname(s_listen,
 		  (struct sockaddr *)&myaddr_in, &addrlen) == -1){
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     
@@ -4171,7 +4191,7 @@
   /* socket buffer sizing has been done. */
   
   tcpipv6_rr_response->data_port_number = (int) ntohs(myaddr_in.sin6_port);
-  netperf_response.serv_errno   = 0;
+  netperf_response.content.serv_errno   = 0;
   
   /* But wait, there's more. If the initiator wanted cpu measurements, */
   /* then we must call the calibrate routine, which will return the max */
@@ -4248,7 +4268,7 @@
 	  timed_out = 1;
 	  break;
 	}
-	netperf_response.serv_errno = errno;
+	netperf_response.content.serv_errno = errno;
 	send_response();
 	exit(1);
       }
@@ -4280,7 +4300,7 @@
 	fflush(where);						
 	break;
       }
-      netperf_response.serv_errno = 992;
+      netperf_response.content.serv_errno = 992;
       send_response();
       exit(1);
     }
@@ -4323,6 +4343,7 @@
   tcpipv6_rr_results->trans_received = trans_received;
   tcpipv6_rr_results->elapsed_time   = elapsed_time;
   tcpipv6_rr_results->cpu_method     = cpu_method;
+  tcpipv6_rr_results->num_cpus       = lib_num_loc_cpus;
   if (tcpipv6_rr_request->measure_cpu) {
     tcpipv6_rr_results->cpu_util	= calc_cpu_util(elapsed_time);
   }
@@ -4423,11 +4444,11 @@
   struct	tcpipv6_conn_rr_results_struct	*tcpipv6_conn_rr_result;
   
   tcpipv6_conn_rr_request = 
-    (struct tcpipv6_conn_rr_request_struct *)netperf_request.test_specific_data;
+    (struct tcpipv6_conn_rr_request_struct *)netperf_request.content.test_specific_data;
   tcpipv6_conn_rr_response = 
-    (struct tcpipv6_conn_rr_response_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_conn_rr_response_struct *)netperf_response.content.test_specific_data;
   tcpipv6_conn_rr_result =
-    (struct tcpipv6_conn_rr_results_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_conn_rr_results_struct *)netperf_response.content.test_specific_data;
   
   
 #ifdef HISTOGRAM
@@ -4458,11 +4479,14 @@
       fflush(where);
     }
   }
-  if ((hp = hostname2addr(remote_host,AF_INET6)) == NULL) {
+  (void)res_init();
+  _res.options |= RES_USE_INET6;
+  if ((hp = gethostbyname(remote_host)) == NULL) {
     fprintf(where,
 	    "send_tcpipv6_conn_rr: could not resolve the name %s\n",
 	    remote_host);
     fflush(where);
+    exit(1);
   }
   
   bcopy(hp->h_addr,
@@ -4549,7 +4573,7 @@
   /* default should be used. Alignment is the exception, it will */
   /* default to 8, which will be no alignment alterations. */
   
-  netperf_request.request_type	        =	DO_TCP_CRR;
+  netperf_request.content.request_type	        =	DO_TCP_CRR;
   tcpipv6_conn_rr_request->recv_buf_size	=	rsr_size;
   tcpipv6_conn_rr_request->send_buf_size	=	rss_size;
   tcpipv6_conn_rr_request->recv_alignment	=	remote_recv_align;
@@ -4588,7 +4612,7 @@
   
   recv_response();
   
-  if (!netperf_response.serv_errno) {
+  if (!netperf_response.content.serv_errno) {
     rsr_size	=	tcpipv6_conn_rr_response->recv_buf_size;
     rss_size	=	tcpipv6_conn_rr_response->send_buf_size;
     rem_nodelay	=	tcpipv6_conn_rr_response->no_delay;
@@ -4604,7 +4628,7 @@
     }
   }
   else {
-    errno = netperf_response.serv_errno;
+    errno = netperf_response.content.serv_errno;
     perror("netperf: remote error");
     
     exit(1);
@@ -4838,12 +4862,12 @@
   /* wasn't supposed to care, it will return obvious values. */
   
   recv_response();
-  if (!netperf_response.serv_errno) {
+  if (!netperf_response.content.serv_errno) {
     if (debug)
       fprintf(where,"remote results obtained\n");
   }
   else {
-    errno = netperf_response.serv_errno;
+    errno = netperf_response.content.serv_errno;
     perror("netperf: remote error");
     
     exit(1);
@@ -4903,7 +4927,7 @@
       remote_service_demand = calc_service_demand((double) nummessages*1024,
 						  0.0,
 						  remote_cpu_utilization,
-						  tcp_ipv6_conn_rr_result->num_cpus);
+						  tcpipv6_conn_rr_result->num_cpus);
     }
     else {
       remote_cpu_utilization = -1.0;
@@ -5047,11 +5071,11 @@
   struct	tcpipv6_conn_rr_results_struct	*tcpipv6_conn_rr_results;
   
   tcpipv6_conn_rr_request = 
-    (struct tcpipv6_conn_rr_request_struct *)netperf_request.test_specific_data;
+    (struct tcpipv6_conn_rr_request_struct *)netperf_request.content.test_specific_data;
   tcpipv6_conn_rr_response = 
-    (struct tcpipv6_conn_rr_response_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_conn_rr_response_struct *)netperf_response.content.test_specific_data;
   tcpipv6_conn_rr_results = 
-    (struct tcpipv6_conn_rr_results_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_conn_rr_results_struct *)netperf_response.content.test_specific_data;
   
   if (debug) {
     fprintf(where,"netserver: recv_tcpipv6_conn_rr: entered...\n");
@@ -5076,7 +5100,7 @@
     fflush(where);
   }
   
-  netperf_response.response_type = TCP_CRR_RESPONSE;
+  netperf_response.content.response_type = TCP_CRR_RESPONSE;
   
   if (debug) {
     fprintf(where,"recv_tcpipv6_conn_rr: the response type is set...\n");
@@ -5147,7 +5171,7 @@
 				SOCK_STREAM);
   
   if (s_listen < 0) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     send_response();
     if (debug) {
       fprintf(where,"could not create data socket\n");
@@ -5165,7 +5189,7 @@
   if (bind(s_listen,
 	   (struct sockaddr *)&myaddr_in,
 	   sizeof(myaddr_in)) == -1) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     if (debug) {
@@ -5177,7 +5201,7 @@
 
   /* Now, let's set-up the socket to listen for connections */
   if (listen(s_listen, 5) == -1) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     if (debug) {
@@ -5192,7 +5216,7 @@
   if (getsockname(s_listen,
 		  (struct sockaddr *)&myaddr_in,
 		  &addrlen) == -1){
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     if (debug) {
@@ -5212,7 +5236,7 @@
 	    tcpipv6_conn_rr_response->data_port_number);
     fflush(where);
   }
-  netperf_response.serv_errno   = 0;
+  netperf_response.content.serv_errno   = 0;
   
   /* But wait, there's more. If the initiator wanted cpu measurements, */
   /* then we must call the calibrate routine, which will return the max */
@@ -5298,7 +5322,7 @@
 	  timed_out = 1;
 	  break;
 	}
-	netperf_response.serv_errno = errno;
+	netperf_response.content.serv_errno = errno;
 	send_response();
 	exit(1);
       }
@@ -5328,7 +5352,7 @@
 	fflush(where);						
 	break;
       }
-      netperf_response.serv_errno = 99;
+      netperf_response.content.serv_errno = 99;
       send_response();
       exit(1);
     }
@@ -5473,11 +5497,11 @@
   struct	tcpipv6_tran_rr_results_struct	*tcpipv6_tran_rr_result;
   
   tcpipv6_tran_rr_request = 
-    (struct tcpipv6_tran_rr_request_struct *)netperf_request.test_specific_data;
+    (struct tcpipv6_tran_rr_request_struct *)netperf_request.content.test_specific_data;
   tcpipv6_tran_rr_response = 
-    (struct tcpipv6_tran_rr_response_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_tran_rr_response_struct *)netperf_response.content.test_specific_data;
   tcpipv6_tran_rr_result =
-    (struct tcpipv6_tran_rr_results_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_tran_rr_results_struct *)netperf_response.content.test_specific_data;
   
   
 #ifdef HISTOGRAM
@@ -5508,11 +5532,14 @@
       fflush(where);
     }
   }
-  if ((hp = hostname2addr(remote_host,AF_INET6)) == NULL) {
+  (void)res_init();
+  _res.options |= RES_USE_INET6;
+  if ((hp = gethostbyname(remote_host)) == NULL) {
     fprintf(where,
 	    "send_tcpipv6_tran_rr: could not resolve the name %s\n",
 	    remote_host);
     fflush(where);
+    exit(1);
   }
   
   bcopy(hp->h_addr,
@@ -5599,7 +5626,7 @@
   /* default should be used. Alignment is the exception, it will */
   /* default to 8, which will be no alignment alterations. */
   
-  netperf_request.request_type	        =	DO_TCPIPV6_TRR;
+  netperf_request.content.request_type	        =	DO_TCPIPV6_TRR;
   tcpipv6_tran_rr_request->recv_buf_size	=	rsr_size;
   tcpipv6_tran_rr_request->send_buf_size	=	rss_size;
   tcpipv6_tran_rr_request->recv_alignment	=	remote_recv_align;
@@ -5638,7 +5665,7 @@
   
   recv_response();
   
-  if (!netperf_response.serv_errno) {
+  if (!netperf_response.content.serv_errno) {
     rsr_size	=	tcpipv6_tran_rr_response->recv_buf_size;
     rss_size	=	tcpipv6_tran_rr_response->send_buf_size;
     rem_nodelay	=	tcpipv6_tran_rr_response->no_delay;
@@ -5654,7 +5681,7 @@
     }
   }
   else {
-    errno = netperf_response.serv_errno;
+    errno = netperf_response.content.serv_errno;
     perror("netperf: remote error");
     
     exit(1);
@@ -5874,12 +5901,12 @@
   /* wasn't supposed to care, it will return obvious values. */
   
   recv_response();
-  if (!netperf_response.serv_errno) {
+  if (!netperf_response.content.serv_errno) {
     if (debug)
       fprintf(where,"remote results obtained\n");
   }
   else {
-    errno = netperf_response.serv_errno;
+    errno = netperf_response.content.serv_errno;
     perror("netperf: remote error");
     
     exit(1);
@@ -6085,11 +6112,11 @@
   struct	tcpipv6_tran_rr_results_struct	*tcpipv6_tran_rr_results;
   
   tcpipv6_tran_rr_request = 
-    (struct tcpipv6_tran_rr_request_struct *)netperf_request.test_specific_data;
+    (struct tcpipv6_tran_rr_request_struct *)netperf_request.content.test_specific_data;
   tcpipv6_tran_rr_response = 
-    (struct tcpipv6_tran_rr_response_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_tran_rr_response_struct *)netperf_response.content.test_specific_data;
   tcpipv6_tran_rr_results = 
-    (struct tcpipv6_tran_rr_results_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_tran_rr_results_struct *)netperf_response.content.test_specific_data;
   
   if (debug) {
     fprintf(where,"netserver: recv_tcpipv6_tran_rr: entered...\n");
@@ -6114,7 +6141,7 @@
     fflush(where);
   }
   
-  netperf_response.response_type = TCPIPV6_TRR_RESPONSE;
+  netperf_response.content.response_type = TCPIPV6_TRR_RESPONSE;
   
   if (debug) {
     fprintf(where,"recv_tcpipv6_tran_rr: the response type is set...\n");
@@ -6185,7 +6212,7 @@
 				SOCK_STREAM);
   
   if (s_listen < 0) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     send_response();
     if (debug) {
       fprintf(where,"could not create data socket\n");
@@ -6203,7 +6230,7 @@
   if (bind(s_listen,
 	   (struct sockaddr *)&myaddr_in,
 	   sizeof(myaddr_in)) == -1) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     if (debug) {
@@ -6224,14 +6251,14 @@
 	    "recv_tcpipv6_tran_rr: could not set TCP_NOPUSH errno %d\n",
 	    errno);
     fflush(where);
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
   }
 
   /* Now, let's set-up the socket to listen for connections */
   if (listen(s_listen, 5) == -1) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     if (debug) {
@@ -6246,7 +6273,7 @@
   if (getsockname(s_listen,
 		  (struct sockaddr *)&myaddr_in,
 		  &addrlen) == -1){
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     if (debug) {
@@ -6266,7 +6293,7 @@
 	    tcpipv6_tran_rr_response->data_port_number);
     fflush(where);
   }
-  netperf_response.serv_errno   = 0;
+  netperf_response.content.serv_errno   = 0;
   
   /* But wait, there's more. If the initiator wanted cpu measurements, */
   /* then we must call the calibrate routine, which will return the max */
@@ -6357,7 +6384,7 @@
 	  timed_out = 1;
 	  break;
 	}
-	netperf_response.serv_errno = errno;
+	netperf_response.content.serv_errno = errno;
 	send_response();
 	exit(1);
       }
@@ -6390,7 +6417,7 @@
 	fflush(where);						
 	break;
       }
-      netperf_response.serv_errno = 99;
+      netperf_response.content.serv_errno = 99;
       send_response();
       exit(1);
     }
@@ -6535,11 +6562,11 @@
 #endif /* INTERVALS */
 
   tcpipv6_rr_request = 
-    (struct tcpipv6_rr_request_struct *)netperf_request.test_specific_data;
+    (struct tcpipv6_rr_request_struct *)netperf_request.content.test_specific_data;
   tcpipv6_rr_response=
-    (struct tcpipv6_rr_response_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_rr_response_struct *)netperf_response.content.test_specific_data;
   tcpipv6_rr_result	=
-    (struct tcpipv6_rr_results_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_rr_results_struct *)netperf_response.content.test_specific_data;
   
 #ifdef HISTOGRAM
   time_hist = HIST_new();
@@ -6561,11 +6588,14 @@
       fflush(where);
     }
   }
-  if ((hp = hostname2addr(remote_host,AF_INET6)) == NULL) {
+  (void)res_init();
+  _res.options |= RES_USE_INET6;
+  if ((hp = gethostbyname(remote_host)) == NULL) {
     fprintf(where,
 	    "send_tcp_nbrr: could not resolve the name %s\n",
 	    remote_host);
     fflush(where);
+    exit(1);
   }
   
   bcopy(hp->h_addr,
@@ -6687,7 +6717,7 @@
     /* default should be used. Alignment is the exception, it will */
     /* default to 8, which will be no alignment alterations. */
     
-    netperf_request.request_type	=	DO_TCP_NBRR;
+    netperf_request.content.request_type	=	DO_TCP_NBRR;
     tcpipv6_rr_request->recv_buf_size	=	rsr_size;
     tcpipv6_rr_request->send_buf_size	=	rss_size;
     tcpipv6_rr_request->recv_alignment      =	remote_recv_align;
@@ -6726,7 +6756,7 @@
   
     recv_response();
   
-    if (!netperf_response.serv_errno) {
+    if (!netperf_response.content.serv_errno) {
       if (debug)
 	fprintf(where,"remote listen done.\n");
       rsr_size          = tcpipv6_rr_response->recv_buf_size;
@@ -6739,7 +6769,7 @@
       server.sin6_port   = htons(server.sin6_port);
     }
     else {
-      errno = netperf_response.serv_errno;
+      errno = netperf_response.content.serv_errno;
       perror("netperf: remote error");
       
       exit(1);
@@ -6936,12 +6966,12 @@
     /* wasn't supposed to care, it will return obvious values. */
     
     recv_response();
-    if (!netperf_response.serv_errno) {
+    if (!netperf_response.content.serv_errno) {
       if (debug)
 	fprintf(where,"remote results obtained\n");
     }
     else {
-      errno = netperf_response.serv_errno;
+      errno = netperf_response.content.serv_errno;
       perror("netperf: remote error");
       
       exit(1);
@@ -7178,11 +7208,11 @@
   struct	tcpipv6_rr_results_struct	*tcpipv6_rr_results;
   
   tcpipv6_rr_request = 
-    (struct tcpipv6_rr_request_struct *)netperf_request.test_specific_data;
+    (struct tcpipv6_rr_request_struct *)netperf_request.content.test_specific_data;
   tcpipv6_rr_response =
-    (struct tcpipv6_rr_response_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_rr_response_struct *)netperf_response.content.test_specific_data;
   tcpipv6_rr_results =
-    (struct tcpipv6_rr_results_struct *)netperf_response.test_specific_data;
+    (struct tcpipv6_rr_results_struct *)netperf_response.content.test_specific_data;
   
   if (debug) {
     fprintf(where,"netserver: recv_tcp_nbrr: entered...\n");
@@ -7207,7 +7237,7 @@
     fflush(where);
   }
   
-  netperf_response.response_type = TCPIPV6_RR_RESPONSE;
+  netperf_response.content.response_type = TCPIPV6_RR_RESPONSE;
   
   if (debug) {
     fprintf(where,"recv_tcp_nbrr: the response type is set...\n");
@@ -7276,7 +7306,7 @@
 				SOCK_STREAM);
   
   if (s_listen < 0) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     send_response();
     
     exit(1);
@@ -7291,7 +7321,7 @@
   if (bind(s_listen,
 	   (struct sockaddr *)&myaddr_in,
 	   sizeof(myaddr_in)) == -1) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     
@@ -7300,7 +7330,7 @@
   
   /* Now, let's set-up the socket to listen for connections */
   if (listen(s_listen, 5) == -1) {
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     
@@ -7312,7 +7342,7 @@
   addrlen = sizeof(myaddr_in);
   if (getsockname(s_listen,
 		  (struct sockaddr *)&myaddr_in, &addrlen) == -1){
-    netperf_response.serv_errno = errno;
+    netperf_response.content.serv_errno = errno;
     close(s_listen);
     send_response();
     
@@ -7324,7 +7354,7 @@
   /* socket buffer sizing has been done. */
   
   tcpipv6_rr_response->data_port_number = (int) ntohs(myaddr_in.sin6_port);
-  netperf_response.serv_errno   = 0;
+  netperf_response.content.serv_errno   = 0;
   
   /* But wait, there's more. If the initiator wanted cpu measurements, */
   /* then we must call the calibrate routine, which will return the max */
@@ -7415,7 +7445,7 @@
 	  continue;
 	}
 	else {
-	  netperf_response.serv_errno = errno;
+	  netperf_response.content.serv_errno = errno;
 	  send_response();
 	  exit(1);
 	}
@@ -7448,7 +7478,7 @@
 	fflush(where);						
 	break;
       }
-      netperf_response.serv_errno = 992;
+      netperf_response.content.serv_errno = 992;
       send_response();
       exit(1);
     }
@@ -7491,6 +7521,7 @@
   tcpipv6_rr_results->trans_received = trans_received;
   tcpipv6_rr_results->elapsed_time   = elapsed_time;
   tcpipv6_rr_results->cpu_method     = cpu_method;
+  tcpipv6_rr_results->num_cpus       = lib_num_loc_cpus;
   if (tcpipv6_rr_request->measure_cpu) {
     tcpipv6_rr_results->cpu_util	= calc_cpu_util(elapsed_time);
   }
diff -uN local-orig/netperf-2.1pl2/nettest_ipv6.h local-new/netperf-2.1pl2/nettest_ipv6.h
--- local-orig/netperf-2.1pl2/nettest_ipv6.h
+++ local-new/netperf-2.1pl2/nettest_ipv6.h
@@ -51,6 +51,7 @@
   float	         cpu_util;	/* -1 if not measured */
   float	         serv_dem;	/* -1 if not measured */
   int            cpu_method;    /* how was cpu util measured? */
+  int            num_cpus;      /* how many CPUs had the remote? */
 };
 
 struct	tcpipv6_rr_request_struct {
@@ -91,6 +92,7 @@
   float	        cpu_util;	/* -1 if not measured */
   float	        serv_dem;	/* -1 if not measured */
   int           cpu_method;    /* how was cpu util measured? */
+  int           num_cpus;      /* how many CPUs had the remote? */
 };
 
 struct	tcpipv6_conn_rr_request_struct {
@@ -132,6 +134,7 @@
   float	cpu_util;	/* -1 if not measured */
   float	serv_dem;	/* -1 if not measured */
   int   cpu_method;    /* how was cpu util measured? */
+  int           num_cpus;      /* how many CPUs had the remote? */
 };
 
 struct	tcpipv6_tran_rr_request_struct {
@@ -173,6 +176,7 @@
   float	cpu_util;	/* -1 if not measured */
   float	serv_dem;	/* -1 if not measured */
   int   cpu_method;    /* how was cpu util measured? */
+  int           num_cpus;      /* how many CPUs had the remote? */
 };
 
 struct	udpipv6_stream_request_struct {
@@ -206,6 +210,7 @@
   float	        elapsed_time;
   float	        cpu_util;
   int           cpu_method;    /* how was cpu util measured? */
+  int           num_cpus;      /* how many CPUs had the remote? */
 };
 
 
@@ -247,6 +252,7 @@
   float	        cpu_util;	/* -1 if not measured */
   float	        serv_dem;	/* -1 if not measured */
   int           cpu_method;    /* how was cpu util measured? */
+  int           num_cpus;      /* how many CPUs had the remote? */
 };
 
 extern void scan_sockets_args();
diff -uN local-orig/netperf-2.1pl2/nettest_unix.c local-new/netperf-2.1pl2/nettest_unix.c
--- local-orig/netperf-2.1pl2/nettest_unix.c
+++ local-new/netperf-2.1pl2/nettest_unix.c
@@ -45,7 +45,8 @@
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
-#ifndef __bsdi__
+#include <sys/param.h>
+#ifndef BSD
 #include <malloc.h>
 #endif
      
diff -uN local-orig/netperf-2.1pl2/snapshot_script local-new/netperf-2.1pl2/snapshot_script
--- local-orig/netperf-2.1pl2/snapshot_script
+++ local-new/netperf-2.1pl2/snapshot_script
@@ -37,7 +37,7 @@
 #
 # where is netperf installed, there are a few possible places:
 
-NETPERF_CMD=${NETPERF_CMD:=/opt/netperf/netperf}
+NETPERF_CMD=${NETPERF_CMD:=/usr/local/netperf/netperf}
 
 
 # there should be no more than two parms passed
diff -uN local-orig/netperf-2.1pl2/tcp_range_script local-new/netperf-2.1pl2/tcp_range_script
--- local-orig/netperf-2.1pl2/tcp_range_script
+++ local-new/netperf-2.1pl2/tcp_range_script
@@ -43,7 +43,7 @@
 # where is netperf, and are there any "constant" options such as 
 # the netserver port number
 #NETHOME=/usr/etc/net_perf
-NETHOME="."
+NETHOME="/usr/local/netperf"
 NETPERF=$NETHOME/netperf $PORT
 
 # How accurate we want the estimate of performance: 
diff -uN local-orig/netperf-2.1pl2/tcp_rr_script local-new/netperf-2.1pl2/tcp_rr_script
--- local-orig/netperf-2.1pl2/tcp_rr_script
+++ local-new/netperf-2.1pl2/tcp_rr_script
@@ -23,9 +23,9 @@
 fi
 
 # where the programs are
-#NETHOME=/usr/local/netperf
+NETHOME=/usr/local/netperf
 #NETHOME="/opt/netperf"
-NETHOME=.
+#NETHOME=.
 
 # at what port will netserver be waiting? If you decide to run
 # netserver at a differnet port than the default of 12865, then set
diff -uN local-orig/netperf-2.1pl2/tcp_stream_script local-new/netperf-2.1pl2/tcp_stream_script
--- local-orig/netperf-2.1pl2/tcp_stream_script
+++ local-new/netperf-2.1pl2/tcp_stream_script
@@ -22,9 +22,9 @@
 fi
 
 # where the programs are
-#NETHOME=/usr/local/netperf
+NETHOME=/usr/local/netperf
 #NETHOME="/opt/netperf"
-NETHOME=.
+#NETHOME=.
 
 # at what port will netserver be waiting? If you decide to run
 # netserver at a differnet port than the default of 12865, then set
diff -uN local-orig/netperf-2.1pl2/udp_rr_script local-new/netperf-2.1pl2/udp_rr_script
--- local-orig/netperf-2.1pl2/udp_rr_script
+++ local-new/netperf-2.1pl2/udp_rr_script
@@ -20,9 +20,9 @@
 
 # where the programs are
 
-#NETHOME=/usr/local/netperf
+NETHOME=/usr/local/netperf
 #NETHOME="/opt/netperf"
-NETHOME="."
+#NETHOME="."
 
 # at what port will netserver be waiting? If you decide to run
 # netserver at a differnet port than the default of 12865, then set
diff -uN local-orig/netperf-2.1pl2/udp_stream_script local-new/netperf-2.1pl2/udp_stream_script
--- local-orig/netperf-2.1pl2/udp_stream_script
+++ local-new/netperf-2.1pl2/udp_stream_script
@@ -17,9 +17,9 @@
 
 # where the programs are
 
-#NETHOME=/usr/local/netperf
+NETHOME=/usr/local/netperf
 #NETHOME="/opt/netperf"
-NETHOME="."
+#NETHOME="."
 
 # at what port will netserver be waiting? If you decide to run
 # netserver at a differnet port than the default of 12865, then set
diff -uN local-orig/netperf-2.1pl2/makefile local-new/netperf-2.1pl2/makefile
--- local-orig/netperf-2.1pl2/makefile
+++ local-new/netperf-2.1pl2/makefile
@@ -15,8 +15,8 @@
 # for the rest of the world, it is probably better to put the binaries
 # in /usr/local/netperf or /opt/netperf
 #
-#NETPERF_HOME = /usr/local/netperf
-NETPERF_HOME = /opt/netperf
+NETPERF_HOME = /usr/local/netperf
+#NETPERF_HOME = /opt/netperf
 
 # The compiler on your system might be somewhere else, and/or have
 # a different name.
@@ -36,7 +36,7 @@
 # You may safely ignore that warning.
 #
 
-CC = cc
+CC = cc -Wall
 
 # Adding flags to CFLAGS enables some non-mainline features. For
 # more information, please consult the source code.
@@ -83,7 +83,7 @@
 # -U__hpux    - Use this when compiling _on_ HP-UX *for* an HP-RT system
 
 LOG_FILE=DEBUG_LOG_FILE="\"/tmp/netperf.debug\""
-CFLAGS = -O -Ae -D$(LOG_FILE) -DUSE_LOOPER 
+CFLAGS = -g -O -pipe -D$(LOG_FILE) -DUSE_LOOPER -DHISTOGRAM -DDO_UNIX -DDO_IPV6
 
 # Some platforms, and some options, require additional libraries.
 # you can add to the "LIBS =" line to accomplish this. if you find
@@ -181,6 +181,7 @@
 netserver.o:	netserver.c nettest_bsd.h netlib.h makefile
 
 install:	netperf netserver
+		mkdir -p $(NETPERF_HOME)
 		chmod -w *.[ch]
 		chmod +x $(NETPERF_SCRIPTS)
 		cp netperf $(NETPERF_HOME)
@@ -236,7 +237,7 @@
 		$(SHAR_EXE_FILES) \
 		$(SHAR_SCRIPT_FILES) $(SCAF_FILES)
 	compress netperf-scaf.tar
-	
+
 netperf-scaf.shar:	$(SHAR_EXE_FILES) \
 			$(SHAR_SCRIPT_FILES) \
 			$(SCAF_FILES)
diff -uN local-orig/apache_1.2.1/conf/access.conf-dist local-new/apache_1.2.1/conf/access.conf-dist
--- local-orig/apache_1.2.1/conf/access.conf-dist
+++ local-new/apache_1.2.1/conf/access.conf-dist
@@ -12,7 +12,7 @@
 
 # This should be changed to whatever you set DocumentRoot to.
 
-<Directory /usr/local/etc/httpd/htdocs>
+<Directory /usr/local/www/data>
 
 # This may also be "None", "All", or any combination of "Indexes",
 # "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
@@ -38,7 +38,7 @@
 # /usr/local/etc/httpd/cgi-bin should be changed to whatever your ScriptAliased
 # CGI directory exists, if you have that configured.
 
-<Directory /usr/local/etc/httpd/cgi-bin>
+<Directory /usr/local/www/cgi-bin>
 AllowOverride None
 Options None
 </Directory>
diff -uN local-orig/apache_1.2.1/conf/httpd.conf-dist local-new/apache_1.2.1/conf/httpd.conf-dist
--- local-orig/apache_1.2.1/conf/httpd.conf-dist
+++ local-new/apache_1.2.1/conf/httpd.conf-dist
@@ -33,7 +33,7 @@
 #  On HPUX you may not be able to use shared memory as nobody, and the
 #  suggested workaround is to create a user www and use that user.
 User nobody
-Group #-1
+Group nogroup
 
 # The following directive disables keepalives and HTTP header flushes for
 # Netscape 2.x and browsers which spoof it. There are known problems with
@@ -49,7 +49,7 @@
 # ServerRoot: The directory the server's config, error, and log files
 # are kept in
 
-ServerRoot /usr/local/etc/httpd
+ServerRoot /usr/local/www/server
 
 # BindAddress: You can support virtual hosts with this option. This option
 # is used to tell the server which IP address to listen to. It can either
@@ -61,21 +61,23 @@
 # ErrorLog: The location of the error log file. If this does not start
 # with /, ServerRoot is prepended to it.
 
-ErrorLog logs/error_log
+ErrorLog /var/log/httpd-error.log
 
 # TransferLog: The location of the transfer log file. If this does not
 # start with /, ServerRoot is prepended to it.
 
-TransferLog logs/access_log
+TransferLog /var/log/httpd-access.log
+
+#LogFormat "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\""
 
 # PidFile: The file the server should log its pid to
-PidFile logs/httpd.pid
+PidFile /var/run/httpd.pid
 
 # ScoreBoardFile: File used to store internal server process information.
 # Not all architectures require this.  But if yours does (you'll know because
 # this file is created when you run Apache) then you *must* ensure that
 # no two invocations of Apache share the same scoreboard file.
-ScoreBoardFile logs/apache_status
+ScoreBoardFile /var/run/apache_status
 
 # ServerName allows you to set a host name which is sent back to clients for
 # your server if it's different than the one the program would get (i.e. use
@@ -180,10 +182,10 @@
  
 #<VirtualHost host.some_domain.com>
 #ServerAdmin webmaster@host.some_domain.com
-#DocumentRoot /www/docs/host.some_domain.com
+#DocumentRoot /usr/local/www/host.some_domain.com/data
 #ServerName host.some_domain.com
-#ErrorLog logs/host.some_domain.com-error_log
-#TransferLog logs/host.some_domain.com-access_log
+#ErrorLog /var/log/host.some_domain.com-error_log
+#TransferLog /var/log/host.some_domain.com-access_log
 #</VirtualHost>
 
 
diff -uN local-orig/apache_1.2.1/conf/srm.conf-dist local-new/apache_1.2.1/conf/srm.conf-dist
--- local-orig/apache_1.2.1/conf/srm.conf-dist
+++ local-new/apache_1.2.1/conf/srm.conf-dist
@@ -12,7 +12,7 @@
 # documents. By default, all requests are taken from this directory, but
 # symbolic links and aliases may be used to point to other locations.
 
-DocumentRoot /usr/local/etc/httpd/htdocs
+DocumentRoot /usr/local/www/data
 
 # UserDir: The name of the directory which is appended onto a user's home
 # directory if a ~user request is recieved.
@@ -135,12 +135,12 @@
 # require it to be present in the URL.  So "/icons" isn't aliased in this
 # example.
 
-#Alias /icons/ /usr/local/etc/httpd/icons/
+Alias /icons/ /usr/local/www/icons/
 
 # ScriptAlias: This controls which directories contain server scripts.
 # Format: ScriptAlias fakename realname
 
-#ScriptAlias /cgi-bin/ /usr/local/etc/httpd/cgi-bin/
+ScriptAlias /cgi-bin/ /usr/local/www/cgi-bin/
 
 # If you want to use server side includes, or CGI outside
 # ScriptAliased directories, uncomment the following lines.
diff -uN local-orig/apache_1.2.1/src/Makefile.tmpl local-new/apache_1.2.1/src/Makefile.tmpl
--- local-orig/apache_1.2.1/src/Makefile.tmpl
+++ local-new/apache_1.2.1/src/Makefile.tmpl
@@ -3,14 +3,14 @@
 # This is combined with the information in the "Configuration" file
 # by the configure script to make the actual Makefile.
 
-CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
+CFLAGS+=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
 LIBS=$(EXTRA_LIBS) $(LIBS1)
 INCLUDES=$(INCLUDES1) $(EXTRA_INCLUDES)
 LFLAGS=$(LFLAGS1) $(EXTRA_LFLAGS)
 
 OBJS= alloc.o http_main.o http_core.o http_config.o http_request.o \
   http_log.o http_protocol.o rfc1413.o util.o util_script.o modules.o buff.o\
-  md5c.o util_md5.o explain.o http_bprintf.o util_date.o util_snprintf.o\
+  util_md5.o explain.o http_bprintf.o util_date.o util_snprintf.o\
   $(MODULES)
 
 .c.o:
diff -uN local-orig/apache_1.2.1/src/conf.h local-new/apache_1.2.1/src/conf.h
--- local-orig/apache_1.2.1/src/conf.h
+++ local-new/apache_1.2.1/src/conf.h
@@ -408,6 +408,7 @@
 #undef NO_SETSID
 #define JMP_BUF sigjmp_buf
 #define HAVE_MMAP
+#define HAVE_SNPRINTF
 #define DEFAULT_USER "nobody"
 #define DEFAULT_GROUP "nogroup"
 #if defined(__bsdi__) || \
@@ -576,6 +577,9 @@
 #include <sys/ioctl.h>
 #ifndef MPE
 #include <arpa/inet.h>  /* for inet_ntoa */
+#define _ARPA_NAMESER_H_
+#define MAXDNAME	1025
+#include <resolv.h>  /* for RES_USE_INET6 */
 #endif
 #include <time.h>  /* for ctime */
 #include <signal.h>
diff -uN local-orig/apache_1.2.1/src/http_conf_globals.h local-new/apache_1.2.1/src/http_conf_globals.h
--- local-orig/apache_1.2.1/src/http_conf_globals.h
+++ local-new/apache_1.2.1/src/http_conf_globals.h
@@ -62,7 +62,7 @@
 extern gid_t group_id_list[NGROUPS_MAX];
 #endif
 extern int max_requests_per_child;
-extern struct in_addr bind_address;
+extern struct in6_addr bind_address;
 extern listen_rec *listeners;
 extern int daemons_to_start;
 extern int daemons_min_free;
diff -uN local-orig/apache_1.2.1/src/http_config.c local-new/apache_1.2.1/src/http_config.c
--- local-orig/apache_1.2.1/src/http_config.c
+++ local-new/apache_1.2.1/src/http_config.c
@@ -852,7 +852,7 @@
 static void get_addresses (pool *p, char *w, server_addr_rec ***paddr, unsigned port)
 {
     struct hostent *hep;
-    unsigned long my_addr;
+    struct in6_addr my_addr;
     server_addr_rec *sar;
     char *t;
     int i, is_an_ip_addr;
@@ -873,26 +873,20 @@
 
     is_an_ip_addr = 0;
     if (strcmp(w, "*") == 0) {
-	my_addr = htonl(INADDR_ANY);
+	my_addr = in6addr_any;
 	is_an_ip_addr = 1;
     } else if( strcmp(w, "_default_") == 0
-	    || strcmp(w, "255.255.255.255") == 0 ) {
-	my_addr = DEFAULT_VHOST_ADDR;
+	    || strcmp(w, "::") == 0 ) {
+	my_addr = in6addr_loopback;
 	is_an_ip_addr = 1;
-    } else if(
-#ifdef DGUX
-	    ( my_addr = inet_network(w) )
-#else
-	    ( my_addr = inet_addr(w) )
-#endif
-	    != INADDR_NONE ) {
+    } else if( inet_pton(AF_INET6, w, &my_addr) > 0 ) {
 	is_an_ip_addr = 1;
     }
     if( is_an_ip_addr ) {
 	sar = pcalloc( p, sizeof( server_addr_rec ) );
 	**paddr = sar;
 	*paddr = &sar->next;
-	sar->host_addr.s_addr = my_addr;
+	sar->host_addr = my_addr;
 	sar->host_port = port;
 	sar->virthost = pstrdup(p, w);
 	if (t != NULL) *t = ':';
@@ -901,7 +895,7 @@
 
     hep = gethostbyname(w);
 
-    if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) {
+    if ((!hep) || (hep->h_addrtype != AF_INET6 || !hep->h_addr_list[0])) {
 	fprintf (stderr, "Cannot resolve host name %s --- ignoring!\n", w);
 	if (t != NULL) *t = ':';
 	return;
@@ -911,7 +905,7 @@
 	sar = pcalloc( p, sizeof( server_addr_rec ) );
 	**paddr = sar;
 	*paddr = &sar->next;
-	sar->host_addr = *(struct in_addr *)hep->h_addr_list[i];
+	sar->host_addr = *(struct in6_addr *)hep->h_addr_list[i];
 	sar->host_port = port;
 	sar->virthost = pstrdup(p, w);
     }
@@ -1042,7 +1036,7 @@
     scoreboard_fname = DEFAULT_SCOREBOARD;
     lock_fname = DEFAULT_LOCKFILE;
     max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
-    bind_address.s_addr = htonl(INADDR_ANY);
+    bind_address = in6addr_any;
     listeners = NULL;
 }
 
@@ -1063,10 +1057,8 @@
     s->keep_alive = 1;
     s->next = NULL;
     s->addrs = pcalloc(p, sizeof (server_addr_rec));
-    s->addrs->host_addr.s_addr = htonl (INADDR_ANY); /* NOT virtual host;
-					       * don't match any real network
-					       * interface.
-					       */
+    s->addrs->host_addr = in6addr_any;
+    /* NOT virtual host; don't match any real network interface. */
     s->addrs->host_port = 0; /* matches any port */
 
     s->module_config = create_server_config (p, s);
diff -uN local-orig/apache_1.2.1/src/http_core.c local-new/apache_1.2.1/src/http_core.c
--- local-orig/apache_1.2.1/src/http_core.c
+++ local-new/apache_1.2.1/src/http_core.c
@@ -327,7 +327,7 @@
 const char *
 get_remote_host(conn_rec *conn, void *dir_config, int type)
 {
-    struct in_addr *iaddr;
+    struct in6_addr *iaddr;
     struct hostent *hptr;
 #ifdef MAXIMUM_DNS
     char **haddr;
@@ -345,8 +345,8 @@
 						SERVER_BUSY_DNS,
 						(request_rec*)NULL);
 #endif /* STATUS */
-	iaddr = &(conn->remote_addr.sin_addr);
-	hptr = gethostbyaddr((char *)iaddr, sizeof(struct in_addr), AF_INET);
+	iaddr = &(conn->remote_addr.sin6_addr);
+	hptr = gethostbyaddr((char *)iaddr, sizeof(struct in6_addr), AF_INET6);
 	if (hptr != NULL)
 	{
 	    conn->remote_host = pstrdup(conn->pool, (void *)hptr->h_name);
@@ -360,7 +360,7 @@
 	    if (hptr)
 	    {
 		for(haddr=hptr->h_addr_list; *haddr; haddr++)
-		    if(((struct in_addr *)(*haddr))->s_addr == iaddr->s_addr)
+		    if(IN6_ARE_ADDR_EQUAL(*haddr, iaddr))
 			break;
 	    }
 	    if((!hptr) || (!(*haddr)))
@@ -1123,7 +1123,7 @@
 #endif
 
 const char *set_bind_address (cmd_parms *cmd, void *dummy, char *arg) {
-    bind_address.s_addr = get_virthost_addr (arg, NULL);
+    bind_address = *get_virthost_addr (arg, NULL);
     return NULL;
 }
 
@@ -1145,15 +1145,18 @@
 	ports = ips;
 
     new=pcalloc(cmd->pool, sizeof(listen_rec));
-    new->local_addr.sin_family = AF_INET;
+#ifdef SIN6_LEN
+    new->local_addr.sin6_len = sizeof(struct sockaddr_in6);
+#endif
+    new->local_addr.sin6_family = AF_INET6;
     if (ports == ips) /* no address */
-	new->local_addr.sin_addr.s_addr = htonl(INADDR_ANY);
+	new->local_addr.sin6_addr = in6addr_any;
     else
-	new->local_addr.sin_addr.s_addr = get_virthost_addr(ips, NULL);
+	new->local_addr.sin6_addr = *get_virthost_addr(ips, NULL);
     port=atoi(ports);
     if(!port)
 	return "Port must be numeric";
-    new->local_addr.sin_port = htons(port);
+    new->local_addr.sin6_port = htons(port);
     new->fd = -1;
     new->used = 0;
     new->next = listeners;
diff -uN local-orig/apache_1.2.1/src/http_main.c local-new/apache_1.2.1/src/http_main.c
--- local-orig/apache_1.2.1/src/http_main.c
+++ local-new/apache_1.2.1/src/http_main.c
@@ -140,7 +140,7 @@
 char *scoreboard_fname;
 char *lock_fname;
 char *server_argv0;
-struct in_addr bind_address;
+struct in6_addr bind_address;
 listen_rec *listeners;
 int daemons_to_start;
 int daemons_min_free;
@@ -1464,7 +1464,7 @@
 pool *pconf;			/* Pool for config stuff */
 pool *ptrans;			/* Pool for per-transaction stuff */
 
-static server_rec *find_virtual_server (struct in_addr server_ip,
+static server_rec *find_virtual_server (struct in6_addr *server_ip,
 				unsigned port, server_rec *server)
 {
     server_rec *virt;
@@ -1475,11 +1475,11 @@
     for (virt = server->next; virt; virt = virt->next) {
 	for (sar = virt->addrs; sar; sar = sar->next) {
 	    if ((virt->is_virtual == 1) &&	/* VirtualHost */
-		(sar->host_addr.s_addr == htonl(INADDR_ANY) ||
-		sar->host_addr.s_addr == server_ip.s_addr) &&
+		(IN6_IS_ADDR_UNSPECIFIED(&sar->host_addr) ||
+		 IN6_ARE_ADDR_EQUAL(&sar->host_addr, server_ip)) &&
 		(sar->host_port == 0 || sar->host_port == port)) {
 		return virt;
-	    } else if ( sar->host_addr.s_addr == DEFAULT_VHOST_ADDR
+	    } else if ( IN6_ARE_ADDR_EQUAL(&sar->host_addr, &in6addr_loopback)
 		&& (sar->host_port == 0 || sar->host_port == port)) {
 		/* this is so that you can build a server that is the
 		    "default" for any interface which isn't explicitly
@@ -1496,7 +1496,7 @@
 void default_server_hostnames(server_rec *s)
 {
     struct hostent *h;
-    struct in_addr *main_addr;
+    struct in6_addr *main_addr;
     int num_addr;
     char *def_hostname;
     int n;
@@ -1533,7 +1533,7 @@
     }
     main_addr = palloc( pconf, sizeof( *main_addr ) * num_addr );
     for (n = 0; n < num_addr; n++) {
-    	main_addr[n] = *(struct in_addr *)h->h_addr_list[n];
+    	main_addr[n] = *(struct in6_addr *)h->h_addr_list[n];
     }
 
     /* Then virtual hosts */
@@ -1543,10 +1543,10 @@
 	has_default_vhost_addr = 0;
 	for (n = 0; n < num_addr; n++) {
 	    for(sar = s->addrs; sar; sar = sar->next) {
-		if (sar->host_addr.s_addr == main_addr[n].s_addr &&
+		if (IN6_ARE_ADDR_EQUAL(&sar->host_addr, &main_addr[n]) &&
 		    s->port == mainport)
 		    s->is_virtual = 2;
-		if( sar->host_addr.s_addr == DEFAULT_VHOST_ADDR ) {
+		if( IN6_ARE_ADDR_EQUAL(&sar->host_addr, &in6addr_loopback )) {
 		    has_default_vhost_addr = 1;
 		}
 	    }
@@ -1571,15 +1571,18 @@
 	    } else {
 		if (s->addrs
 		    && (h = gethostbyaddr ((char *)&(s->addrs->host_addr),
-				   sizeof (struct in_addr), AF_INET))) {
+				   sizeof (struct in6_addr), AF_INET6))) {
 		    s->server_hostname = pstrdup (pconf, (char *)h->h_name);
 		} else {
 		    /* again, what can we do?  They didn't specify a
 			ServerName, and their DNS isn't working. -djg */
 		    if (s->addrs) {
+			char v[64]; /* for Paul Vixie */
+
 			fprintf(stderr, "Failed to resolve server name "
 			    "for %s (check DNS)\n",
-			    inet_ntoa(s->addrs->host_addr));
+			    inet_ntop(AF_INET6, &s->addrs->host_addr,
+				      v, sizeof(v)));
 		    }
 		    s->server_hostname = "bogus_host_without_reverse_dns";
 		}
@@ -1589,11 +1592,12 @@
 }
 
 conn_rec *new_connection (pool *p, server_rec *server, BUFF *inout,
-			  const struct sockaddr_in *remaddr,
-			  const struct sockaddr_in *saddr,
+			  const struct sockaddr_in6 *remaddr,
+			  const struct sockaddr_in6 *saddr,
 			  int child_num)
 {
     conn_rec *conn = (conn_rec *)pcalloc (p, sizeof(conn_rec));
+    char rname[64];
     
     /* Got a connection structure, so initialize what fields we can
      * (the rest are zeroed out by pcalloc).
@@ -1603,14 +1607,17 @@
     
     conn->pool = p;
     conn->local_addr = *saddr;
-    conn->server = find_virtual_server(saddr->sin_addr, ntohs(saddr->sin_port),
+    conn->server = find_virtual_server((struct in6_addr *)&saddr->sin6_addr,
+				       ntohs(saddr->sin6_port),
 				       server);
     conn->base_server = conn->server;
     conn->client = inout;
     
     conn->remote_addr = *remaddr;
     conn->remote_ip = pstrdup (conn->pool,
-			       inet_ntoa(conn->remote_addr.sin_addr));
+			       inet_ntop(AF_INET6,
+					 &conn->remote_addr.sin6_addr,
+					 rname, sizeof(rname)));
 
     return conn;
 }
@@ -1658,8 +1665,8 @@
 #else
     int clen;
 #endif
-    struct sockaddr sa_server;
-    struct sockaddr sa_client;
+    struct sockaddr_in6 sin_server;
+    struct sockaddr_in6 sin_client;
 
     csd = -1;
     dupped_csd = -1;
@@ -1776,8 +1783,8 @@
 	    deferred_die = 0;
 	    signal (SIGUSR1, (void (*)())deferred_die_handler);
             for (;;) {
-                clen = sizeof(sa_client);
-                csd  = accept(sd, &sa_client, &clen);
+                clen = sizeof(sin_client);
+                csd  = accept(sd, (struct sockaddr *)&sin_client, &clen);
 		if (csd >= 0 || errno != EINTR) break;
 		if (deferred_die) {
 		    /* we didn't get a socket, and we were told to die */
@@ -1821,8 +1828,8 @@
          * socket options, file descriptors, and read/write buffers.
          */
 
-	clen = sizeof(sa_server);
-	if (getsockname(csd, &sa_server, &clen) < 0) {
+	clen = sizeof(sin_server);
+	if (getsockname(csd, (struct sockaddr *)&sin_server, &clen) < 0) {
 	    log_unixerr("getsockname", NULL, NULL, server_conf);
 	    continue;
 	}
@@ -1844,8 +1851,7 @@
 	bpushfd(conn_io, csd, dupped_csd);
 
 	current_conn = new_connection (ptrans, server_conf, conn_io,
-				       (struct sockaddr_in *)&sa_client,
-				       (struct sockaddr_in *)&sa_server,
+				       &sin_client, &sin_server,
 				       child_num);
 
         /*
@@ -1971,12 +1977,12 @@
     return 0;
 }
 
-static int make_sock(pool *pconf, const struct sockaddr_in *server)
+static int make_sock(pool *pconf, const struct sockaddr_in6 *server)
 {
     int s;
     int one = 1;
 
-    if ((s = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) == -1) {
+    if ((s = socket(AF_INET6,SOCK_STREAM,IPPROTO_TCP)) == -1) {
         log_unixerr("socket", NULL, "Failed to get a socket, exiting child",
                     server_conf);
         exit(1);
@@ -2033,24 +2039,28 @@
 
 #ifdef MPE
 /* MPE requires CAP=PM and GETPRIVMODE to bind to ports less than 1024 */
-    if (ntohs(server->sin_port) < 1024) GETPRIVMODE();
+    if (ntohs(server->sin6_port) < 1024) GETPRIVMODE();
 #endif
-    if(bind(s, (struct sockaddr *)server,sizeof(struct sockaddr_in)) == -1)
+    if(bind(s, (struct sockaddr *)server,sizeof(struct sockaddr_in6)) == -1)
     {
+	char abuf[64];
+
         perror("bind");
 #ifdef MPE
-        if (ntohs(server->sin_port) < 1024) GETUSERMODE();
+        if (ntohs(server->sin6_port) < 1024) GETUSERMODE();
 #endif
-	if (server->sin_addr.s_addr != htonl(INADDR_ANY))
+	if (!IN6_IS_ADDR_UNSPECIFIED(&server->sin6_addr))
 	    fprintf(stderr,"httpd: could not bind to address %s port %d\n",
-		    inet_ntoa(server->sin_addr), ntohs(server->sin_port));
+		    inet_ntop(AF_INET6, &server->sin6_addr,
+			      abuf, sizeof(abuf)),
+		    ntohs(server->sin6_port));
 	else
 	    fprintf(stderr,"httpd: could not bind to port %d\n",
-		    ntohs(server->sin_port));
+		    ntohs(server->sin6_port));
         exit(1);
     }
 #ifdef MPE
-    if (ntohs(server->sin_port) < 1024) GETUSERMODE();
+    if (ntohs(server->sin6_port) < 1024) GETUSERMODE();
 #endif
     listen(s, 512);
     return s;
@@ -2111,7 +2121,7 @@
 
 void standalone_main(int argc, char **argv)
 {
-    struct sockaddr_in sa_server;
+    struct sockaddr_in6 sin_server;
     int saved_sd;
     int remaining_children_to_start;
 
@@ -2141,11 +2151,14 @@
 
 	if (listeners == NULL) {
 	    if (!is_graceful) {
-		memset ((char *)&sa_server, 0, sizeof (sa_server));
-		sa_server.sin_family = AF_INET;
-		sa_server.sin_addr = bind_address;
-		sa_server.sin_port = htons (server_conf->port);
-		sd = make_sock (pconf, &sa_server);
+		memset ((char *)&sin_server, 0, sizeof (sin_server));
+#ifdef SIN6_LEN
+		sin_server.sin6_len = sizeof(sin_server);
+#endif
+		sin_server.sin6_family = AF_INET6;
+		sin_server.sin6_addr = bind_address;
+		sin_server.sin6_port = htons (server_conf->port);
+		sd = make_sock (pconf, &sin_server);
 	    }
 	    else {
 		sd = saved_sd;
@@ -2336,6 +2349,9 @@
 {
     int c;
 
+    (void) res_init();
+    _res.options |= RES_USE_INET6;
+
 #ifdef AUX
     (void)set42sig();
 #endif
@@ -2405,7 +2421,7 @@
     else {
         conn_rec *conn;
 	request_rec *r;
-	struct sockaddr sa_server, sa_client;
+	struct sockaddr_in6 sin_server, sin_client;
 	BUFF *cio;
       
 	open_logs(server_conf, pconf);
@@ -2430,21 +2446,23 @@
       }
 #endif
 
-	c = sizeof(sa_client);
-	if ((getpeername(fileno(stdin), &sa_client, &c)) < 0)
+	c = sizeof(sin_client);
+	if ((getpeername(fileno(stdin),
+			 (struct sockaddr *)&sin_client, &c)) < 0)
 	{
 /* get peername will fail if the input isn't a socket */
 	    perror("getpeername");
-	    memset(&sa_client, '\0', sizeof(sa_client));
+	    memset(&sin_client, '\0', sizeof(sin_client));
 	}
 
-	c = sizeof(sa_server);
-	if(getsockname(fileno(stdin), &sa_server, &c) < 0) {
+	c = sizeof(sin_server);
+	if(getsockname(fileno(stdin),
+		       (struct sockaddr *)&sin_server, &c) < 0) {
 	    perror("getsockname");
 	    fprintf(stderr, "Error getting local address\n");
 	    exit(1);
 	}
-	server_conf->port =ntohs(((struct sockaddr_in *)&sa_server)->sin_port);
+	server_conf->port =ntohs(sin_server.sin6_port);
 	cio = bcreate(ptrans, B_RDWR);
 #ifdef MPE
 /* HP MPE 5.5 inetd only passes the incoming socket as stdin (fd 0), whereas
@@ -2459,8 +2477,7 @@
 #endif
 	cio->fd_in = fileno(stdin);
 	conn = new_connection (ptrans, server_conf, cio,
-			       (struct sockaddr_in *)&sa_client,
-			       (struct sockaddr_in *)&sa_server,-1);
+			       &sin_client, &sin_server,-1);
 	r = read_request (conn);
 	if (r) process_request (r); /* else premature EOF (ignore) */
 
diff -uN local-orig/apache_1.2.1/src/http_protocol.c local-new/apache_1.2.1/src/http_protocol.c
--- local-orig/apache_1.2.1/src/http_protocol.c
+++ local-new/apache_1.2.1/src/http_protocol.c
@@ -574,20 +574,17 @@
   if (!strcasecmp(host, r->server->server_hostname)) {
     return (uri + r->hostlen);
   }
-  else if (!strcmp(host, inet_ntoa(r->connection->local_addr.sin_addr))) {
-    return (uri + r->hostlen);
-  }
 
-  /* Now things get a bit trickier - check the IP address(es) of the host */
-  /* they gave, see if it matches ours.                                   */
+  /* Now things get a bit trickier - check the IPv6 address(es) of the host */
+  /* they gave, see if it matches ours.                                     */
   else {
     struct hostent *hp;
     int n;
 
     if ((hp = gethostbyname(host))) {
       for (n = 0; hp->h_addr_list[n] != NULL; n++) {
-	if (r->connection->local_addr.sin_addr.s_addr ==
-	    (((struct in_addr *)(hp->h_addr_list[n]))->s_addr)) {
+	if (IN6_ARE_ADDR_EQUAL(&r->connection->local_addr.sin6_addr,
+			       (struct in6_addr *)(hp->h_addr_list[n]))) {
 	  return (uri + r->hostlen);
 	}
       }
diff -uN local-orig/apache_1.2.1/src/httpd.h local-new/apache_1.2.1/src/httpd.h
--- local-orig/apache_1.2.1/src/httpd.h
+++ local-new/apache_1.2.1/src/httpd.h
@@ -75,12 +75,14 @@
 #endif
 
 /* Root of server */
+#ifndef DOCUMENT_LOCATION
 #ifdef __EMX__
 /* Set default for OS/2 file system */ 
 #define DOCUMENT_LOCATION "/os2httpd/docs"
 #else
 #define DOCUMENT_LOCATION "/usr/local/etc/httpd/htdocs"
 #endif
+#endif
 
 /* Max. number of dynamically loaded modules */
 #define DYNAMIC_MODULE_LIMIT 64
@@ -152,13 +154,19 @@
 #endif
 
 /* The name of the document config file */
+#ifndef RESOURCE_CONFIG_FILE
 #define RESOURCE_CONFIG_FILE "conf/srm.conf"
+#endif
 
 /* The name of the MIME types file */
+#ifndef TYPES_CONFIG_FILE
 #define TYPES_CONFIG_FILE "conf/mime.types"
+#endif
 
 /* The name of the access file */
+#ifndef ACCESS_CONFIG_FILE
 #define ACCESS_CONFIG_FILE "conf/access.conf"
+#endif
 
 /* Whether we should enable rfc1413 identity checking */
 #define DEFAULT_RFC1413 0
@@ -547,8 +555,8 @@
   
   /* Who is the client? */
   
-  struct sockaddr_in local_addr; /* local address */
-  struct sockaddr_in remote_addr;/* remote address */
+  struct sockaddr_in6 local_addr; /* local address */
+  struct sockaddr_in6 remote_addr;/* remote address */
   char *remote_ip;		/* Client's IP address */
   char *remote_host;		/* Client's DNS name, if known.
                                  * NULL if DNS hasn't been checked,
@@ -571,15 +579,14 @@
 
 /* Per-vhost config... */
 
-/* The address 255.255.255.255, when used as a virtualhost address,
+/* The address ::1 (loopback), when used as a virtualhost address,
  * will become the "default" server when the ip doesn't match other vhosts.
  */
-#define DEFAULT_VHOST_ADDR 0xfffffffful
 
 typedef struct server_addr_rec server_addr_rec;
 struct server_addr_rec {
     server_addr_rec *next;
-    struct in_addr host_addr;	/* The bound address, for this server */
+    struct in6_addr host_addr;	/* The bound address, for this server */
     unsigned short host_port;	/* The bound port, for this server */   
     char *virthost;		/* The name given in <VirtualHost> */
 };
@@ -635,7 +642,7 @@
 /* These are more like real hosts than virtual hosts */
 struct listen_rec {
     listen_rec *next;
-    struct sockaddr_in local_addr; /* local IP address and port */
+    struct sockaddr_in6 local_addr; /* local IP address and port */
     int fd;
     int used;	/* Only used during restart */
 /* more stuff here, like which protocol is bound to the port */
@@ -712,7 +719,7 @@
 void chdir_file(const char *file);
      
 char *get_local_host(pool *);
-unsigned long get_virthost_addr (const char *hostname, unsigned short *port);
+struct in6_addr *get_virthost_addr (const char *hostname, unsigned short *port);
 
 extern time_t restart_time;
 
diff -uN local-orig/apache_1.2.1/src/mod_rewrite.c local-new/apache_1.2.1/src/mod_rewrite.c
--- local-orig/apache_1.2.1/src/mod_rewrite.c
+++ local-new/apache_1.2.1/src/mod_rewrite.c
@@ -3052,6 +3052,7 @@
 **  special DNS lookup functions
 **
 */
+/* This implies the canonical (ie shortest) address textual form is used ?! */
 
 static int is_this_our_host(request_rec *r, char *testhost)
 {
@@ -3063,6 +3064,7 @@
     char *name;
     int i, j;
     server_addr_rec *sar;
+    char hname[64];
 
     /* we can check:
        r->
@@ -3071,20 +3073,22 @@
        r->server->
             int is_virtual            0=main, 1=ip-virtual, 2=non-ip-virtual
             char *server_hostname     used on compare to r->hostname
-            inet_ntoa(r->connection->local_addr.sin_addr)
+            inet_ntop(AF_INET6, &r->connection->local_addr.sin6_addr, ...)
                                       used on compare to r->hostname
             unsigned short port       for redirects
             char *path                name of ServerPath
             int pathlen               len of ServerPath
             char *names               Wildcarded names for ServerAlias servers 
        r->server->addrs->
-            struct in_addr host_addr  The bound address, for this server
+            struct in6_addr host_addr The bound address, for this server
             short host_port           The bound port, for this server 
             char *virthost            The name given in <VirtualHost> 
     */
 
     ourhostname = r->server->server_hostname;
-    ourhostip   = inet_ntoa(r->connection->local_addr.sin_addr);
+    ourhostip   = (char *)inet_ntop(AF_INET6,
+				    &r->connection->local_addr.sin6_addr,
+				    hname, sizeof(hname));
 
     /* just a simple common case */
     if (strcmp(testhost, ourhostname) == 0 ||
@@ -3095,7 +3099,7 @@
     if (!r->server->is_virtual) {
         /* main servers */
 
-        /* check for the alternative IP addresses */
+        /* check for the alternative IPv6 addresses */
         if ((cppHNLour = resolv_ipaddr_list(r, ourhostname)) == NULL)
             return NO;
         if ((cppHNLtest = resolv_ipaddr_list(r, testhost)) == NULL)
@@ -3132,6 +3136,7 @@
     return NO;
 }
 
+#ifdef notneeded
 static int isaddr(char *host)
 {
     char *cp;
@@ -3142,9 +3147,9 @@
         return NO;
     if (*host == '\0')
         return NO;
-    /* Make sure it has only digits and dots. */
+    /* Make sure it has only hexdigits, dots and colons. */
     for (cp = host; *cp; cp++) {
-        if (!isdigit(*cp) && *cp != '.')
+        if (!isxdigit(*cp) && *cp != '.' && *cp != ':')
             return NO;
     }
     /* If it has a trailing dot, 
@@ -3153,6 +3158,7 @@
        return NO;
     return YES;
 }
+#endif
 
 static char **resolv_ipaddr_list(request_rec *r, char *name)
 {
@@ -3160,17 +3166,20 @@
     struct hostent *hep;
     int i;
 
-    if (isaddr(name)) 
-        hep = gethostbyaddr(name, sizeof(struct in_addr), AF_INET);
-    else
-        hep = gethostbyname(name);
+    hep = gethostbyname(name);
     if (hep == NULL)
         return NULL;
     for (i = 0; hep->h_addr_list[i]; i++)
         ;
     cppHNL = (char **)palloc(r->pool, sizeof(char *)*(i+1));
-    for (i = 0; hep->h_addr_list[i]; i++)
-        cppHNL[i] = pstrdup(r->pool, inet_ntoa(*((struct in_addr *)(hep->h_addr_list[i]))) );
+    for (i = 0; hep->h_addr_list[i]; i++) {
+	struct in6_addr *addr;
+	char name[64];
+
+	addr = (struct in6_addr *)(hep->h_addr_list[i]);
+        cppHNL[i] = pstrdup(r->pool,
+			    inet_ntop(AF_INET6, addr, name, sizeof(name)));
+    }
     cppHNL[i] = NULL;
     return cppHNL;
 }
diff -uN local-orig/apache_1.2.1/src/rfc1413.c local-new/apache_1.2.1/src/rfc1413.c
--- local-orig/apache_1.2.1/src/rfc1413.c
+++ local-new/apache_1.2.1/src/rfc1413.c
@@ -102,10 +102,10 @@
 /* bind_connect - bind both ends of a socket */
 
 static int
-get_rfc1413(int sock, const struct sockaddr_in *our_sin,
-	  const struct sockaddr_in *rmt_sin, char user[256], server_rec *srv)
+get_rfc1413(int sock, const struct sockaddr_in6 *our_sin,
+	  const struct sockaddr_in6 *rmt_sin, char user[256], server_rec *srv)
 {
-    struct sockaddr_in rmt_query_sin, our_query_sin;
+    struct sockaddr_in6 rmt_query_sin, our_query_sin;
     unsigned int rmt_port, our_port;
     int i;
     char *cp;
@@ -121,12 +121,12 @@
      */
 
     our_query_sin = *our_sin;
-    our_query_sin.sin_port = htons(ANY_PORT);
+    our_query_sin.sin6_port = htons(ANY_PORT);
     rmt_query_sin = *rmt_sin;
-    rmt_query_sin.sin_port = htons(RFC1413_PORT);
+    rmt_query_sin.sin6_port = htons(RFC1413_PORT);
 
     if (bind(sock, (struct sockaddr *)&our_query_sin,
-	     sizeof(struct sockaddr_in)) < 0)
+	     sizeof(struct sockaddr_in6)) < 0)
     {
 	log_unixerr("bind", NULL, "rfc1413: Error binding to local port", srv);
 	return -1;
@@ -137,12 +137,12 @@
  * the service
  */
     if (connect(sock, (struct sockaddr *)&rmt_query_sin,
-		sizeof(struct sockaddr_in)) < 0)
+		sizeof(struct sockaddr_in6)) < 0)
 	return -1;
 
 /* send the data */
-    ap_snprintf(buffer, sizeof(buffer), "%u,%u\r\n", ntohs(rmt_sin->sin_port),
-	    ntohs(our_sin->sin_port));
+    ap_snprintf(buffer, sizeof(buffer), "%u,%u\r\n",
+		ntohs(rmt_sin->sin6_port), ntohs(our_sin->sin6_port));
     do i = write(sock, buffer, strlen(buffer));
     while (i == -1 && errno == EINTR);
     if (i == -1)
@@ -167,8 +167,8 @@
     buffer[i] = '\0';
 /* RFC1413_USERLEN = 512 */
     if (sscanf(buffer, "%u , %u : USERID :%*[^:]:%512s", &rmt_port, &our_port,
-	       user) != 3 || ntohs(rmt_sin->sin_port) != rmt_port
-	|| ntohs(our_sin->sin_port) != our_port) return -1;
+	       user) != 3 || ntohs(rmt_sin->sin6_port) != rmt_port
+	|| ntohs(our_sin->sin6_port) != our_port) return -1;
 
     /*
      * Strip trailing carriage return. It is part of the
@@ -197,7 +197,7 @@
 
     result = FROM_UNKNOWN;
 
-    sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+    sock = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
     if (sock < 0)
     {
 	log_unixerr("socket", NULL, "rfc1413: error creating socket", srv);
diff -uN local-orig/apache_1.2.1/src/util.c local-new/apache_1.2.1/src/util.c
--- local-orig/apache_1.2.1/src/util.c
+++ local-new/apache_1.2.1/src/util.c
@@ -1114,27 +1114,27 @@
 
 #if 0
 int get_portnum(int sd) {
-    struct sockaddr addr;
+    struct sockaddr_in6 addr;
     int len;
 
-    len = sizeof(struct sockaddr);
-    if(getsockname(sd,&addr,&len) < 0)
+    len = sizeof(struct sockaddr_in6);
+    if(getsockname(sd,(struct sockaddr *)&addr,&len) < 0)
         return -1;
-    return ntohs(((struct sockaddr_in *)&addr)->sin_port);
+    return ntohs(addr.sin6_port);
 }
 
-struct in_addr get_local_addr(int sd) {
-    struct sockaddr addr;
+struct in6_addr *get_local_addr(int sd) {
+    static struct sockaddr_in6 addr;
     int len;
 
-    len = sizeof(struct sockaddr);
-    if(getsockname(sd,&addr,&len) < 0) {
+    len = sizeof(struct sockaddr_in6);
+    if(getsockname(sd,(struct sockaddr *)&addr,&len) < 0) {
 	perror ("getsockname");
         fprintf (stderr, "Can't get local host address!\n");
 	exit(1);
     }
          
-    return ((struct sockaddr_in *)&addr)->sin_addr;
+    return &(addr.sin6_addr);
 }
 #endif
 
@@ -1142,9 +1142,9 @@
  * Parses a host of the form <address>[:port]
  * :port is permitted if 'port' is not NULL
  */
-unsigned long get_virthost_addr (const char *w, unsigned short *ports) {
+struct in6_addr *get_virthost_addr (const char *w, unsigned short *ports) {
     struct hostent *hep;
-    unsigned long my_addr;
+    static struct in6_addr my_addr;
     char *p;
 
     p = strchr(w, ':');
@@ -1158,23 +1158,19 @@
     if (strcmp(w, "*") == 0)
     {
 	if (p != NULL) *p = ':';
-	return htonl(INADDR_ANY);
+	my_addr = in6addr_any;
+	return &my_addr;
     }
 	
-#ifdef DGUX
-    my_addr = inet_network(w);
-#else
-    my_addr = inet_addr(w);
-#endif
-    if (my_addr != INADDR_NONE)
+    if (inet_pton(AF_INET6, w, &my_addr) > 0)
     {
 	if (p != NULL) *p = ':';
-	return my_addr;
+	return &my_addr;
     }
 
     hep = gethostbyname(w);
 	    
-    if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) {
+    if ((!hep) || (hep->h_addrtype != AF_INET6 || !hep->h_addr_list[0])) {
 	fprintf (stderr, "Cannot resolve host name %s --- exiting!\n", w);
 	exit(1);
     }
@@ -1188,7 +1184,8 @@
 	    
     if (p != NULL) *p = ':';
 
-    return ((struct in_addr *)(hep->h_addr))->s_addr;
+    my_addr = *((struct in6_addr *)(hep->h_addr));
+    return &my_addr;
 }
 
 
diff -uN local-orig/apache_1.2.1/src/util_md5.h local-new/apache_1.2.1/src/util_md5.h
--- local-orig/apache_1.2.1/src/util_md5.h
+++ local-new/apache_1.2.1/src/util_md5.h
@@ -50,7 +50,7 @@
  *
  */
 
-#include "md5.h"
+#include <md5.h>
 
 char *md5(pool *a, unsigned char *string);
 char *md5contextTo64(pool *p, MD5_CTX *context);
diff -uN local-orig/apache_1.2.1/src/util_script.c local-new/apache_1.2.1/src/util_script.c
--- local-orig/apache_1.2.1/src/util_script.c
+++ local-new/apache_1.2.1/src/util_script.c
@@ -201,7 +201,7 @@
     table_set (e, "SERVER_ADMIN", s->server_admin); /* Apache */
     table_set (e, "SCRIPT_FILENAME", r->filename); /* Apache */
     
-    ap_snprintf(port, sizeof(port), "%d", ntohs(c->remote_addr.sin_port));
+    ap_snprintf(port, sizeof(port), "%d", ntohs(c->remote_addr.sin6_port));
     table_set (e, "REMOTE_PORT", port);            /* Apache */
 
     if (c->user) table_set(e, "REMOTE_USER", c->user);
diff -uN local-orig/apache_1.2.1/src/Configuration local-new/apache_1.2.1/src/Configuration
--- local-orig/apache_1.2.1/src/Configuration
+++ local-new/apache_1.2.1/src/Configuration
@@ -41,13 +41,17 @@
 # Settings here have priority; If not set, Configure will attempt to guess
 # the C compiler, and set OPTIM to '-O2'
 #
-EXTRA_CFLAGS=
+EXTRA_CFLAGS= \
+-DHTTPD_ROOT=\"${PREFIX}/www/server\" \
+-DDOCUMENT_LOCATION=\"${PREFIX}/www/data/\" \
+-DDEFAULT_PATH=\"/bin:/usr/bin:${PREFIX}/bin\" \
+-DSUEXEC_BIN=\"${PREFIX}/sbin/suexec\"
 EXTRA_LFLAGS=
-EXTRA_LIBS=
+EXTRA_LIBS=-lmd
 EXTRA_INCLUDES=
 
 #CC=
-#OPTIM=-O2
+OPTIM=
 #RANLIB=
 
 ################################################################
@@ -162,12 +166,12 @@
 ## STATUS=yes (see the Rules section near the start of this file) to allow
 ## full status information.  Check conf/access.conf on how to enable this.
 
-# Module status_module       mod_status.o
+Module status_module       mod_status.o
 
 ## The Info module displays configuration information for the server and 
 ## all included modules. It's very useful for debugging.
 
-# Module info_module         mod_info.o
+Module info_module         mod_info.o
 
 ## mod_include translates server-side include (SSI) statements in text files.
 ## mod_dir handles requests on directories and directory indexes.
@@ -209,7 +213,7 @@
 ## mod_rewrite allows for powerful URI-to-URI and URI-to-filename mapping,
 ## using regular expressions.
 
-# Module rewrite_module      mod_rewrite.o
+Module rewrite_module      mod_rewrite.o
 
 ##
 ## Access control and authentication modules. 
@@ -227,7 +231,7 @@
 ## "gdbm" package if not and possibly adjust EXTRA_LIBS. (This may be
 ## done by Configure at a later date)
 
-# Module db_auth_module      mod_auth_db.o
+Module db_auth_module      mod_auth_db.o
 # Module dbm_auth_module     mod_auth_dbm.o
 
 ## msql_auth checks against an mSQL database.  You must have mSQL installed
@@ -244,24 +248,24 @@
 ## "digest" implements HTTP Digest Authentication rather than the less 
 ## secure Basic Auth used by the other modules.
 
-# Module digest_module       mod_digest.o
+Module digest_module       mod_digest.o
 
 ## Optional response header manipulation modules. 
 ##
 ## cern_meta mimics the behavior of the CERN web server with regards to 
 ## metainformation files.  
 
-# Module cern_meta_module    mod_cern_meta.o
+Module cern_meta_module    mod_cern_meta.o
 
 ## The expires module can apply Expires: headers to resources,
 ## as a function of access time or modification time.
 
-# Module expires_module      mod_expires.o
+Module expires_module      mod_expires.o
 
 ## The headers module can set arbitrary HTTP response headers,
 ## as configured in server, vhost, access.conf or .htaccess configs
 
-# Module headers_module      mod_headers.o
+Module headers_module      mod_headers.o
 
 ## Miscellaneous modules
 ##
diff -uN local-orig/lsof_4.23/dialects/freebsd/dsock.c local-new/lsof_4.23/dialects/freebsd/dsock.c
--- local-orig/lsof_4.23/dialects/freebsd/dsock.c
+++ local-new/lsof_4.23/dialects/freebsd/dsock.c
@@ -49,16 +49,35 @@
 {
 	struct domain d;
 	char dev_ch[32];
+#ifdef IN6ADDR_ANY_INIT
+	struct in6_addr *fa = (struct in6_addr *)NULL;
+	int fa_fam;
+#else
 	struct in_addr *fa = (struct in_addr *)NULL;
+#endif
 	int fam;
 	int fp, lp;
 	struct inpcb inp;
+#ifdef IN6ADDR_ANY_INIT
+	struct in6_addr *la = (struct in6_addr *)NULL;
+	int la_fam;
+#else
 	struct in_addr *la = (struct in_addr *)NULL;
+#endif
 	struct mbuf mb;
 	struct protosw p;
 	struct rawcb raw;
 	struct socket s;
+#ifdef IN6ADDR_ANY_INIT
+	union {
+		struct sockaddr sa;
+		struct sockaddr_in6 s6;
+	} sk;
+#define sad sk.sa
+#define sad6 sk.s6
+#else
 	struct sockaddr sad;
+#endif
 	struct tcpcb t;
 	struct unpcb uc, unp;
 	struct sockaddr_un *ua = NULL;
@@ -122,9 +141,17 @@
  * Process an Internet domain socket.
  */
 	case AF_INET:
+#ifdef IN6ADDR_ANY_INIT
+	case AF_INET6:
+#endif
 	case AF_ROUTE:
 		if (Fnet)
 			Lf->sf |= SELNET;
+#ifdef IN6ADDR_ANY_INIT
+		if (fam == AF_INET6)
+			(void) strcpy(Lf->type, "in6 ");
+		else
+#endif
 		(void) strcpy(Lf->type, (fam == AF_INET) ? "inet" : "rte");
 		printiproto(p.pr_protocol);
 	/*
@@ -149,26 +176,64 @@
 		    enter_dev_ch(dev_ch);
 		    if (raw.rcb_laddr
 		    && !kread((KA_T)raw.rcb_laddr, (char *)&sad, sizeof(sad))) {
+#ifdef IN6ADDR_ANY_INIT
+			la_fam = sad.sa_family;
+			if (sad.sa_family == AF_INET6)
+			    kread((KA_T)raw.rcb_laddr,
+				(char *)&sad6, sizeof(sad6));
+			if (sad.sa_family == AF_INET
+			||  sad.sa_family == AF_ROUTE)
+			    la = (struct in6_addr *)&sad.sa_data[2];
+			else if (sad.sa_family == AF_INET6)
+			    la = &sad6.sin6_addr;
+#else
 			if (sad.sa_family == AF_INET
 			||  sad.sa_family == AF_ROUTE)
 			    la = (struct in_addr *)&sad.sa_data[2];
+#endif
 			else if (sad.sa_family)
 			    printrawaddr(&sad);
 		    }
 		    if (raw.rcb_faddr
 		    && !kread((KA_T)raw.rcb_faddr, (char *)&sad, sizeof(sad))) {
+#ifdef IN6ADDR_ANY_INIT
+			fa_fam = sad.sa_family;
+			if (sad.sa_family == AF_INET6)
+			    kread((KA_T)raw.rcb_laddr,
+				(char *)&sad6, sizeof(sad6));
+			if (sad.sa_family == AF_INET
+			||  sad.sa_family == AF_ROUTE)
+			    fa = (struct in6_addr *)&sad.sa_data[2];
+			else if (sad.sa_family == AF_INET6)
+			    fa = &sad6.sin6_addr;
+#else
 			if (sad.sa_family == AF_INET
 			||  sad.sa_family == AF_ROUTE)
 			    fa = (struct in_addr *)&sad.sa_data[2];
+#endif
 			else if (sad.sa_family) {
 				(void) strcat(endnm(), "->");
 				printrawaddr(&sad);
 			}
 		    }
 		    if (fa || la)
+#ifdef IN6ADDR_ANY_INIT
+			(void) ent_inaddr(fa && fa_fam ? fa_fam : la_fam,
+					  la, -1, fa, -1);
+#else
 			(void) ent_inaddr(la, -1, fa, -1);
+#endif
+		    if (p.pr_protocol == IPPROTO_TCP && inp.inp_ppcb
+		    &&  kread((KA_T)inp.inp_ppcb, (char *)&t, sizeof(t)) == 0) {
+			Lf->lts.type = 0;
+			Lf->lts.state.i = (int)t.t_state;
+		    }
 		} else {
+#ifdef IN6ADDR_ANY_INIT
+		    if (fam != AF_INET && fam != AF_INET6) {
+#else
 		    if (fam != AF_INET) {
+#endif
 			(void) strcpy(Namech, "no further information");
 			break;
 		    }
@@ -186,20 +251,45 @@
 		    (void) sprintf(dev_ch, "0x%08x",
 			(inp.inp_ppcb == NULL) ? s.so_pcb : inp.inp_ppcb);
 		    enter_dev_ch(dev_ch);
+#ifdef IN6ADDR_ANY_INIT
+		    if (inp.inp_latype == IPATYPE_IPV6) {
+			la_fam = AF_INET6;
+			la = &inp.inp_laddr6;
+		    } else {
+			la_fam = AF_INET;
+			la = (struct in6_addr *)&inp.inp_laddr;
+		    }
+#else
 		    la = &inp.inp_laddr;
+#endif
 		    lp = (int)ntohs(inp.inp_lport);
-		    if (inp.inp_faddr.s_addr != INADDR_ANY || inp.inp_fport
-		    != 0) {
+		    if (
+#ifdef IN6ADDR_ANY_INIT
+			inp.inp_fatype != IPATYPE_UNBD ||
+#else
+			inp.inp_faddr.s_addr != INADDR_ANY ||
+#endif
+			inp.inp_fport != 0) {
+#ifdef IN6ADDR_ANY_INIT
+			if (inp.inp_fatype == IPATYPE_IPV6) {
+			    fa_fam = AF_INET6;
+			    fa = &inp.inp_faddr6;
+			} else {
+			    fa_fam = AF_INET;
+			    fa = (struct in6_addr *)&inp.inp_faddr;
+			}
+#else
 			fa = &inp.inp_faddr;
+#endif
 			fp = (int)ntohs(inp.inp_fport);
 		    }
 		    if (fa || la)
+#ifdef IN6ADDR_ANY_INIT
+			(void) ent_inaddr(fa && fa_fam ? fa_fam : la_fam,
+					  la, lp, fa, fp);
+#else
 			(void) ent_inaddr(la, lp, fa, fp);
-		    if (p.pr_protocol == IPPROTO_TCP && inp.inp_ppcb
-		    &&  kread((KA_T)inp.inp_ppcb, (char *)&t, sizeof(t)) == 0) {
-			Lf->lts.type = 0;
-			Lf->lts.state.i = (int)t.t_state;
-		    }
+#endif
 		}
 		break;
 /*
diff -uN local-orig/lsof_4.23/dialects/n+obsd/dsock.c local-new/lsof_4.23/dialects/n+obsd/dsock.c
--- local-orig/lsof_4.23/dialects/n+obsd/dsock.c
+++ local-new/lsof_4.23/dialects/n+obsd/dsock.c
@@ -49,16 +49,35 @@
 {
 	struct domain d;
 	char dev_ch[32];
+#ifdef IN6ADDR_ANY_INIT
+	struct in6_addr *fa = (struct in6_addr *)NULL;
+	int fa_fam;
+#else
 	struct in_addr *fa = (struct in_addr *)NULL;
+#endif
 	int fam;
 	int fp, lp;
 	struct inpcb inp;
+#ifdef IN6ADDR_ANY_INIT
+	struct in6_addr *la = (struct in6_addr *)NULL;
+	int la_fam;
+#else
 	struct in_addr *la = (struct in_addr *)NULL;
+#endif
 	struct mbuf mb;
 	struct protosw p;
 	struct rawcb raw;
 	struct socket s;
+#ifdef IN6ADDR_ANY_INIT
+	union {
+		struct sockaddr sa;
+		struct sockaddr_in6 s6;
+	} sk;
+#define sad sk.sa
+#define sad6 sk.s6
+#else
 	struct sockaddr sad;
+#endif
 	struct tcpcb t;
 	struct unpcb uc, unp;
 	struct sockaddr_un *ua = NULL;
@@ -122,11 +141,18 @@
  * Process an Internet domain socket.
  */
 	case AF_INET:
+#ifdef IN6ADDR_ANY_INIT
+	case AF_INET6:
+#endif
 	case AF_ROUTE:
 		if (Fnet)
 			Lf->sf |= SELNET;
-		(void) strcpy(Lf->type, (fam == AF_INET) ? "inet"
-							 : "rte ");
+#ifdef IN6ADDR_ANY_INIT
+		if (fam == AF_INET6)
+			(void) strcpy(Lf->type, "in6 ");
+		else
+#endif
+		(void) strcpy(Lf->type, (fam == AF_INET) ? "inet" : "rte");
 		printiproto(p.pr_protocol);
 	/*
 	 * Read protocol control block.
@@ -150,26 +176,64 @@
 		    enter_dev_ch(dev_ch);
 		    if (raw.rcb_laddr
 		    && !kread((KA_T)raw.rcb_laddr, (char *)&sad, sizeof(sad))) {
+#ifdef IN6ADDR_ANY_INIT
+			la_fam = sad.sa_family;
+			if (sad.sa_family == AF_INET6)
+			    kread((KA_T)raw.rcb_laddr,
+				(char *)&sad6, sizeof(sad6));
+			if (sad.sa_family == AF_INET
+			||  sad.sa_family == AF_ROUTE)
+			    la = (struct in6_addr *)&sad.sa_data[2];
+			else if (sad.sa_family == AF_INET6)
+			    la = &sad6.sin6_addr;
+#else
 			if (sad.sa_family == AF_INET
 			||  sad.sa_family == AF_ROUTE)
 			    la = (struct in_addr *)&sad.sa_data[2];
+#endif
 			else if (sad.sa_family)
 			    printrawaddr(&sad);
 		    }
 		    if (raw.rcb_faddr
 		    && !kread((KA_T)raw.rcb_faddr, (char *)&sad, sizeof(sad))) {
+#ifdef IN6ADDR_ANY_INIT
+			fa_fam = sad.sa_family;
+			if (sad.sa_family == AF_INET6)
+			    kread((KA_T)raw.rcb_laddr,
+				(char *)&sad6, sizeof(sad6));
+			if (sad.sa_family == AF_INET
+			||  sad.sa_family == AF_ROUTE)
+			    fa = (struct in6_addr *)&sad.sa_data[2];
+			else if (sad.sa_family == AF_INET6)
+			    fa = &sad6.sin6_addr;
+#else
 			if (sad.sa_family == AF_INET
 			||  sad.sa_family == AF_ROUTE)
 			    fa = (struct in_addr *)&sad.sa_data[2];
+#endif
 			else if (sad.sa_family) {
 				(void) strcat(endnm(), "->");
 				printrawaddr(&sad);
 			}
 		    }
 		    if (fa || la)
+#ifdef IN6ADDR_ANY_INIT
+			(void) ent_inaddr(fa && fa_fam ? fa_fam : la_fam,
+					  la, -1, fa, -1);
+#else
 			(void) ent_inaddr(la, -1, fa, -1);
+#endif
+		    if (p.pr_protocol == IPPROTO_TCP && inp.inp_ppcb
+		    &&  kread((KA_T)inp.inp_ppcb, (char *)&t, sizeof(t)) == 0) {
+			Lf->lts.type = 0;
+			Lf->lts.state.i = (int)t.t_state;
+		    }
 		} else {
+#ifdef IN6ADDR_ANY_INIT
+		    if (fam != AF_INET && fam != AF_INET6) {
+#else
 		    if (fam != AF_INET) {
+#endif
 			(void) strcpy(Namech, "no further information");
 			break;
 		    }
@@ -187,20 +251,45 @@
 		    (void) sprintf(dev_ch, "0x%08x",
 			(inp.inp_ppcb == NULL) ? s.so_pcb : inp.inp_ppcb);
 		    enter_dev_ch(dev_ch);
+#ifdef IN6ADDR_ANY_INIT
+		    if (inp.inp_latype == IPATYPE_IPV6) {
+			la_fam = AF_INET6;
+			la = &inp.inp_laddr6;
+		    } else {
+			la_fam = AF_INET;
+			la = (struct in6_addr *)&inp.inp_laddr;
+		    }
+#else
 		    la = &inp.inp_laddr;
+#endif
 		    lp = (int)ntohs(inp.inp_lport);
-		    if (inp.inp_faddr.s_addr != INADDR_ANY || inp.inp_fport
-		    != 0) {
+		    if (
+#ifdef IN6ADDR_ANY_INIT
+			inp.inp_fatype != IPATYPE_UNBD ||
+#else
+			inp.inp_faddr.s_addr != INADDR_ANY ||
+#endif
+			inp.inp_fport != 0) {
+#ifdef IN6ADDR_ANY_INIT
+			if (inp.inp_fatype == IPATYPE_IPV6) {
+			    fa_fam = AF_INET6;
+			    fa = &inp.inp_faddr6;
+			} else {
+			    fa_fam = AF_INET;
+			    fa = (struct in6_addr *)&inp.inp_faddr;
+			}
+#else
 			fa = &inp.inp_faddr;
+#endif
 			fp = (int)ntohs(inp.inp_fport);
 		    }
 		    if (fa || la)
+#ifdef IN6ADDR_ANY_INIT
+			(void) ent_inaddr(fa && fa_fam ? fa_fam : la_fam,
+					  la, lp, fa, fp);
+#else
 			(void) ent_inaddr(la, lp, fa, fp);
-		    if (p.pr_protocol == IPPROTO_TCP && inp.inp_ppcb
-		    &&  kread((KA_T)inp.inp_ppcb, (char *)&t, sizeof(t)) == 0) {
-			Lf->lts.type = 0;
-			Lf->lts.state.i = (int)t.t_state;
-		    }
+#endif
 		}
 		break;
 /*
diff -uN local-orig/lsof_4.23/arg.c local-new/lsof_4.23/arg.c
--- local-orig/lsof_4.23/arg.c
+++ local-new/lsof_4.23/arg.c
@@ -385,6 +385,8 @@
 	struct servent *se, *se1;
 	char *sn = (char *)NULL;
 	MALLOC_S snl = 0;
+	char *ipext;
+	int ipproto;
 
 	if (na == NULL) {
 	    (void) fprintf(stderr, "%s: no network address specified\n", Pn);
@@ -394,14 +396,18 @@
  * Initialize network address structure.
  */
 	n.proto = NULL;
+#ifdef IN6ADDR_ANY_INIT
+	n.ad = in6addr_any;
+#else
 	n.a[0] = n.a[1] = n.a[2] = n.a[3] = 0;
+#endif
 /*
  * Process protocol name, optionally followed by a '@' and a host name or
- * Internet address, or a ':' and a service name or port number.
+ * Internet address, or a ':' or '/' and a service name or port number.
  */
 	wa = na;
-	if (*wa && *wa != '@' && *wa != ':') {
-	    for (p = wa; *wa && *wa != '@' && *wa != ':'; wa++)
+	if (*wa && *wa != '@' && *wa != ':' && *wa != '/') {
+	    for (p = wa; *wa && *wa != '@' && *wa != ':' && *wa != '/'; wa++)
 		;
 	    if ((l = wa - p)) {
 		if ((n.proto = (char *)malloc(l + 1)) == NULL) {
@@ -422,8 +428,13 @@
 	    /*
 	     * The protocol name should be "tcp" or "udp".
 	     */
+#ifdef IN6ADDR_ANY_INIT
+		if (strncasecmp(n.proto, "tcp", 3) != 0
+		&&  strncasecmp(n.proto, "udp", 3) != 0)
+#else
 		if (strcasecmp(n.proto, "tcp") != 0
 		&&  strcasecmp(n.proto, "udp") != 0)
+#endif
 		{
 			(void) fprintf(stderr,
 		    	    "%s: unknown protocol name (%s) in %s\n",
@@ -445,7 +456,39 @@
  */
 	if (*wa == '@') {
 	    wa++;
-	    if ( ! *wa || *wa == ':') {
+#ifdef IN6ADDR_ANY_INIT
+	    if ( ! *wa ) {
+
+unacc_address:
+		(void) fprintf(stderr,
+		    "%s: unacceptable Internet address in %s\n", Pn, na);
+		goto nwad_exit;
+	    }
+	    if (!(p = strchr(wa, '/'))) {
+		p = strchr(wa, ':');
+		if (p && strchr(p+1, ':'))
+		    p = 0;	/* IPv6 addr, use / as limit, : is ambiguous */
+	    }
+	    if (!p) p = wa + strlen(wa);
+	    if (!(l = p - wa))
+		goto unacc_address;
+	    if ((hn = (char *)malloc(l + 1)) == NULL) {
+		fprintf(stderr,
+		    "%s: no space for host name from %s\n", Pn, na);
+		goto nwad_exit;
+	    }
+	    (void) strncpy(hn, wa, l);
+	    hn[l] = '\0';
+	    if ((he = gethostbyname(hn)) == NULL) {
+		fprintf(stderr, "%s: unknown host name (%s) in \"%s\"\n",
+		    Pn, hn, na);
+		goto nwad_exit;
+	    }
+	    ap = (unsigned char *)he->h_addr;
+	    bcopy(ap, &n.ad, he->h_length);
+	    wa = p;
+#else
+	    if ( ! *wa || *wa == ':' || *wa == '/') {
 
 unacc_address:
 		(void) fprintf(stderr,
@@ -456,7 +499,7 @@
 	/*
 	 * Assemble host name.
 	 */
-		for (p = wa; *p && *p != ':'; p++)
+		for (p = wa; *p && *p != ':' && *p != '/'; p++)
 		    ;
 		if ((l = p - wa)) {
 		    if ((hn = (char *)malloc(l + 1)) == NULL) {
@@ -485,6 +528,8 @@
 		for (l = 0; *wa; wa++) {
 		    if (*wa == ':')
 			break;
+		    if (*wa == '/')
+			break;
 		    if (*wa == '.') {
 			l++;
 			if (l > 3)
@@ -501,6 +546,7 @@
 		||  (n.a[0] == 0 && n.a[1] == 0 && n.a[2] == 0 && n.a[3] == 0))
 		    goto unacc_address;
 	    }
+#endif
 	}
 /*
  * If there is no port number, enter the address.
@@ -521,7 +567,7 @@
  * minus sign in a name is taken to be part of the name, the starting entry
  * of a range can't be a service name.
  */
-	if (*wa != ':' || *(wa + 1) == '\0') {
+	if ((*wa != ':' && *wa != '/') || *(wa + 1) == '\0') {
 
 unacc_port:
 	    (void) fprintf(stderr,
@@ -560,12 +606,28 @@
 		    }
 		    (void) strncpy(sn, p, l);
 		    *(sn + l) = '\0';
+		    for (ipext = n.proto; *ipext;)
+			ipext++;
+		    switch (*--ipext) {
+		      case '4':
+		    	*ipext = '\0';
+			ipproto = 4;
+			break;
+		      case '6':
+			*ipext = '\0';
+			ipproto = 6;
+			break;
+		      default:
+			ipproto = 0;
+		    }
 		    if (n.proto) {
 
 		    /*
 		     * If the protocol has been specified, look up the port
 		     * number for the service name for the specified protocol.
 		     */
+			if (ipproto != 0)
+			    *ipext = ipproto + '0';
 			if (!(se = getservbyname(sn, n.proto))) {
 			    (void) fprintf(stderr,
 				"%s: unknown service %s for %s in %s\n",
@@ -579,6 +641,8 @@
 		     * If no protocol has been specified, look up the port
 		     * numbers for the service name for both TCP and UDP.
 		     */
+			if (ipproto != 0)
+			    *ipext = ipproto + '0';
 			if((se = getservbyname(sn, "tcp")))
 			    pt = (int)ntohs(se->s_port);
 			if ((se1 = getservbyname(sn, "udp")))
@@ -693,7 +757,11 @@
 	 * list.
 	 */
 	    if (!nc.proto
+#ifdef IN6ADDR_ANY_INIT
+	    && IN6_IS_ADDR_UNSPECIFIED(&nc.ad)
+#else
 	    &&  nc.a[0] == 0 && nc.a[1] == 0 && nc.a[2] == 0 && nc.a[3] == 0
+#endif
 	    &&  sp == -1) {
 		(void) fprintf(stderr,
 		    "%s: incomplete Internet address specification:  %s\n",
@@ -736,10 +804,14 @@
 		break;
 	    if (!(ap = (unsigned char *)he->h_addr_list[ac++]))
 		break;
+#ifdef IN6ADDR_ANY_INIT
+	    bcopy(ap, &nc.ad, he->h_length);
+#else
 	    nc.a[0] = *ap++;
 	    nc.a[1] = *ap++;
 	    nc.a[2] = *ap++;
 	    nc.a[3] = *ap;
+#endif
 	}
 	return(0);
 }
diff -uN local-orig/lsof_4.23/lsof.8 local-new/lsof_4.23/lsof.8
--- local-orig/lsof_4.23/lsof.8
+++ local-new/lsof_4.23/lsof.8
@@ -53,10 +53,12 @@
 	DC/OSx 1.1 for Pyramid systems
 	Digital UNIX (DEC OSF/1) 2.0, 3.2, and 4.0
 	FreeBSD 2.1.[67], 2.2 and 3.0 for Intel-based systems
+	FreeBSD 2.[12] with IPv6 support
 	HP-UX 9.x and 10.20
 	IRIX 5.3, 6.2, 6.3, and 6.4
 	Linux 2.0.3[012] and 2.1.7[02] for Intel-based systems
 	NetBSD 1.[23] for Intel and SPARC-based systems
+	NetBSD 1.[23] with IPv6 support
 	NEXTSTEP 3.1 for NEXTSTEP architectures
 	OpenBSD 2.[012] for Intel-based systems
 	Reliant UNIX 5.43 for Pyramid systems
@@ -446,7 +448,7 @@
 .IP
 An Internet address is specified in the form:
 .IP
-[\fIprotocol\fP][@\fIhostname\fP\||\|\fIhostaddr\fP][:\fIservice\fP\||\|\fIport\fP]
+[\fIprotocol\fP][@\fIhostname\fP\||\|\fIhostaddr\fP][(:|/)\fIservice\fP\||\|\fIport\fP]
 .IP
 where:
 .nf
@@ -467,7 +469,7 @@
 .IR protocol ,
 host specification, service or port specification \- must be supplied.
 The `@' character, leading the host specification, is always required;
-as is the `:', leading the port specification.
+as is the `:' or `/', leading the port specification.
 Specify either
 .I hostname
 or
@@ -485,6 +487,9 @@
 the service name are different.
 Use any case \- lower or upper \- for
 .IR protocol .
+If
+.I protocol
+is suffixed by 4 (resp. 6), only IPv4 (resp. IPv6) connexions are listed.
 .IP
 .I Service
 names and
@@ -502,6 +507,8 @@
 
 .br
 	TCP:25 \- TCP and port 25
+.br
+	TCP6:25 \- TCP over IPv6 and port 25
 .br
 	@1.2.3.4 \- Internet host address 1.2.3.4
 .br
diff -uN local-orig/lsof_4.23/lsof.h local-new/lsof_4.23/lsof.h
--- local-orig/lsof_4.23/lsof.h
+++ local-new/lsof_4.23/lsof.h
@@ -43,7 +43,6 @@
 
 #include <ctype.h>
 #include <errno.h>
-#include <netdb.h>
 #include <pwd.h>
 #include <stdio.h>
 
@@ -63,6 +62,7 @@
 };
 
 #include "dlsof.h"
+#include <netdb.h>
 
 extern int errno;
 extern char *optarg;
@@ -360,7 +360,12 @@
 	struct linaddr {		/* local Internet address information */
 		int as;			/* address status: 0 == none */
 		int p;			/* port */
+#ifdef IN6ADDR_ANY_INIT
+		int af;			/* address family */
+		struct in6_addr ia;	/* Internet address */
+#else
 		struct in_addr ia;	/* Internet address */
+#endif
 	} li[2];			/* li[0]: local
 					 * li[1]: foreign */
 	struct ltstate {		/* local TCP/TPI state */
@@ -454,10 +459,19 @@
 extern int Nuidexcl;
 extern int Nuidincl;
 
+#ifdef IN6ADDR_ANY_INIT
+#define	intoin6(ia)	((struct in6_addr *)(ia))
+#define	intoin4(ia)	((struct in_addr *)(ia))
+#define	in6maptoin(ia)	((struct in_addr *)&(ia)->s6_addr[12])
+#endif
 struct nwad {
 	char *arg;				/* argument */
 	char *proto;				/* protocol */
+#ifdef IN6ADDR_ANY_INIT
+	struct in6_addr ad; 			/* address */
+#else
 	unsigned char a[4];			/* address */
+#endif
 	int sport;				/* starting port */
 	int eport;				/* ending port */
 	int f;					/* find state */
diff -uN local-orig/lsof_4.23/main.c local-new/lsof_4.23/main.c
--- local-orig/lsof_4.23/main.c
+++ local-new/lsof_4.23/main.c
@@ -39,7 +39,9 @@
 
 
 #include "lsof.h"
-
+#ifdef IN6ADDR_ANY_INIT
+#include <resolv.h>
+#endif
 
 /*
  * Local definitions
@@ -94,6 +96,12 @@
 		(void) fprintf(stderr, "%s: no space for name buffer\n", Pn);
 		Exit(1);
 	}
+#ifdef IN6ADDR_ANY_INIT
+	if ((_res.options & RES_INIT) == 0)
+		(void) res_init();
+	_res.options |= RES_USE_INET6;
+#endif
+
 /*
  * Create option mask.
  */
diff -uN local-orig/lsof_4.23/misc.c local-new/lsof_4.23/misc.c
--- local-orig/lsof_4.23/misc.c
+++ local-new/lsof_4.23/misc.c
@@ -568,9 +568,37 @@
  * is_nw_addr() - is this network address selected?
  */
 
+#ifdef IN6ADDR_ANY_INIT
+static int
+matchproto(f)
+char *f;
+{
+	int typ = 0;
+	char *p = f;
+
+	if (!f || !*f)
+		return(1);
+	while (*p) p++;
+	p--;
+	if (*p == '6') {
+		if (Lf->type[2] != '6') return 0;
+	} else if (*p == '4') {
+		if (Lf->type[2] == '6') return 0;
+	} else
+		p++;
+	return (strncasecmp(f, Lf->iproto, p-f) == 0);
+}
+#endif
+
 int
+#ifdef IN6ADDR_ANY_INIT
+is_nw_addr(af, ia, p)
+	int af;				/* Internet address family */
+	char *ia;			/* Internet address */
+#else
 is_nw_addr(ia, p)
 	struct in_addr *ia;		/* Internet address */
+#endif
 	int p;				/* port */
 {
 	struct nwad *n;
@@ -581,15 +609,33 @@
 	u = (unsigned char *)ia;
 	for (; n; n = n->next) {
 		if (n->proto) {
+#ifdef IN6ADDR_ANY_INIT
+			if (!matchproto(n->proto))
+#else
 			if (strcasecmp(n->proto, Lf->iproto) != 0)
+#endif
+				continue;
+		}
+#ifdef IN6ADDR_ANY_INIT
+		if (!IN6_IS_ADDR_UNSPECIFIED(&n->ad)) {
+		    if (af == AF_INET6) {
+			if (!IN6_ARE_ADDR_EQUAL(&n->ad, intoin6(ia)))
+				continue;
+		    } else {
+			if (!IN6_IS_ADDR_V4MAPPED(&n->ad))
+				continue;
+			if (in6maptoin(&n->ad)->s_addr != intoin4(ia)->s_addr)
 				continue;
+		    }
 		}
+#else
 		if (n->a[0] != 0 || n->a[1] != 0
 		||  n->a[2] != 0 || n->a[3] != 0) {
 			if (u[3] != n->a[3] || u[2] != n->a[2]
 			||  u[1] != n->a[1] || u[0] != n->a[0])
 				continue;
 		}
+#endif
 		if (n->sport == -1
 		||  (p >= n->sport && p <= n->eport)) {
 			n->f = 1;
diff -uN local-orig/lsof_4.23/print.c local-new/lsof_4.23/print.c
--- local-orig/lsof_4.23/print.c
+++ local-new/lsof_4.23/print.c
@@ -56,7 +56,15 @@
 					 * and fill_porttab() */
 
 struct hostcache {
+#ifdef IN6ADDR_ANY_INIT
+	int af;
+	union {
+		struct in6_addr ad6;
+		struct in_addr ad4;
+	} ad;
+#else
 	unsigned char addr[4];
+#endif
 	char *name;
 };
 
@@ -325,10 +333,16 @@
  */
 
 char *
+#ifdef IN6ADDR_ANY_INIT
+gethostnm(af, ia)
+	int af;			/* Internet address family */
+	char *ia;		/* pointer to Internet address */
+#else
 gethostnm(ia)
 	struct in_addr *ia;		/* pointer to Internet address */
+#endif
 {
-	char hbuf[32];
+	char hbuf[64];
 	static struct hostcache *hc = (struct hostcache *)NULL;
 	static int hcx = 0;
 	char *hn, *np;
@@ -336,15 +350,31 @@
 	struct hostent *he = (struct hostent *)NULL;
 	static int nhc = 0;
 	unsigned char *u;
+#ifdef IN6ADDR_ANY_INIT
+	int len = (af == AF_INET6) ?	sizeof(struct in6_addr) :
+					sizeof(struct in_addr);
+#endif
 
 	u = (unsigned char *)ia;
 /*
  * Search cache.
  */
 	for (i = 0; i < hcx; i++) {
+#ifdef IN6ADDR_ANY_INIT
+		if (af != hc[i].af)
+			continue;
+		if (af == AF_INET6) {
+			if (!IN6_ARE_ADDR_EQUAL(&hc[i].ad.ad6, intoin6(ia)))
+				continue;
+		} else {
+			if (hc[i].ad.ad4.s_addr != intoin4(ia)->s_addr)
+				continue;
+		}
+#else
 		if (u[3] != hc[i].addr[3] || u[2] != hc[i].addr[2]
 		||  u[1] != hc[i].addr[1] || u[0] != hc[i].addr[0])
 			continue;
+#endif
 		return(hc[i].name);
 	}
 /*
@@ -354,9 +384,17 @@
  * address.
  */
 	if (Fhost)
+#ifdef IN6ADDR_ANY_INIT
+ 		he = gethostbyaddr((char *)ia, len, af);
+ #else
 		he = gethostbyaddr((char *)ia, sizeof(struct in_addr), AF_INET);
+#endif
 	if (!he || !he->h_name) {
+#ifdef IN6ADDR_ANY_INIT
+		(void) inet_ntop(af, u, hbuf, sizeof(hbuf));
+#else
 		(void) sprintf(hbuf, "%u.%u.%u.%u", u[0], u[1], u[2], u[3]);
+#endif
 		hn = hbuf;
 	} else
 		hn = (char *)he->h_name;
@@ -386,10 +424,18 @@
 			Exit(1);
 		}
 	}
+#ifdef IN6ADDR_ANY_INIT
+	hc[hcx].af = af;
+	if(af == AF_INET6)
+		hc[hcx].ad.ad6 = *intoin6(ia);
+	else
+		hc[hcx].ad.ad4.s_addr = intoin4(ia)->s_addr;
+#else
 	hc[hcx].addr[0] = u[0];
 	hc[hcx].addr[1] = u[1];
 	hc[hcx].addr[2] = u[2];
 	hc[hcx].addr[3] = u[3];
+#endif
 	hc[hcx++].name = np;
 	return(np);
 }
@@ -886,10 +932,21 @@
 	/*
 	 * Convert the address to a host name.
 	 */
+#ifdef IN6ADDR_ANY_INIT
+	    if (Lf->li[i].af == AF_INET6 &&
+		IN6_IS_ADDR_UNSPECIFIED(intoin6(&Lf->li[i].ia)))
+		host ="*";
+	    else if (Lf->li[i].af == AF_INET &&
+		     intoin4(&Lf->li[i].ia)->s_addr == INADDR_ANY)
+		host ="*";
+	    else
+		host = gethostnm(Lf->li[i].af, (char *)&Lf->li[i].ia);
+#else
 	    if (Lf->li[i].ia.s_addr == INADDR_ANY)
 		host ="*";
 	    else
 		host = gethostnm(&Lf->li[i].ia);
+#endif
 	/*
 	 * Process the port number.
 	 */
@@ -907,12 +964,28 @@
 		 * loopback address 127.0.0.1.  (Test 2 may not always work
 		 * -- e.g., on hosts with multiple interfaces.)
 		 */
-		    if ((src = i) && FportMap
-		    &&  (Lf->li[i].ia.s_addr == INADDR_LOOPBACK
-		    ||   (Lf->li[0].as &&
-		          Lf->li[0].ia.s_addr == Lf->li[1].ia.s_addr)))
-		    {
-			src = 0;
+		    if ((src = i) && FportMap) {
+#ifdef IN6ADDR_ANY_INIT
+			if (Lf->li[i].af == AF_INET6) {
+			    if (IN6_IS_ADDR_LOOPBACK(intoin6(&Lf->li[i].ia)) ||
+				(Lf->li[0].as &&
+				 IN6_ARE_ADDR_EQUAL(intoin6(&Lf->li[0].ia),
+						    intoin6(&Lf->li[1].ia)) ))
+				    src = 0;
+			} else {
+			    if (intoin4(&Lf->li[i].ia)->s_addr ==
+							INADDR_LOOPBACK ||
+				(Lf->li[0].as &&
+				 intoin4(&Lf->li[0].ia)->s_addr ==
+						intoin4(&Lf->li[1].ia)->s_addr))
+				    src = 0;
+			}
+#else
+			if  (Lf->li[i].ia.s_addr == INADDR_LOOPBACK ||
+			     (Lf->li[0].as &&
+			      Lf->li[0].ia.s_addr == Lf->li[1].ia.s_addr))
+				src = 0;
+#endif
 		    }
 		    if (strcasecmp(Lf->iproto, "TCP") == 0)
 			port = lkup_port(Lf->li[i].p, 0, src);
@@ -1022,6 +1095,12 @@
 		break;
 #endif
 
+#if	defined(IPPROTO_ICMPV6)
+	case IPPROTO_ICMPV6:
+		s = "ICMP";
+		break;
+#endif
+
 #if	defined(IPPROTO_IGMP)
 	case IPPROTO_IGMP:
 		s = "IGMP";
@@ -1264,6 +1343,8 @@
 printrawaddr(sa)
 	struct sockaddr *sa;		/* socket address */
 {
+	/* should use sa_len ? */
+
 	(void) sprintf(endnm(), "%u/%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u",
 		sa->sa_family,
 		(unsigned char)sa->sa_data[0],
@@ -1439,6 +1520,12 @@
 		s = "INET";
 		break;
 #endif	/* defined(AF_INET) */
+
+#if	defined(AF_INET6)
+	case AF_INET6:
+		s = "INET6";
+		break;
+#endif	/* defined(AF_INET6) */
 
 #if	defined(AF_IMPLINK)
 	case AF_IMPLINK:
diff -uN local-orig/lsof_4.23/proc.c local-new/lsof_4.23/proc.c
--- local-orig/lsof_4.23/proc.c
+++ local-new/lsof_4.23/proc.c
@@ -238,22 +238,38 @@
  */
 
 void
+#ifdef IN6ADDR_ANY_INIT
+ent_inaddr(af, la, lp, fa, fp)
+	int af;				/* address family */
+	struct in6_addr *la;		/* local Internet address */
+	int lp;				/* local port */
+	struct in6_addr *fa;		/* foreign Internet address -- may
+					 * be NULL to indicate no foreign
+					 * address is known */
+#else
 ent_inaddr(la, lp, fa, fp)
 	struct in_addr *la;		/* local Internet address */
 	int lp;				/* local port */
 	struct in_addr *fa;		/* foreign Internet address -- may
 					 * be NULL to indicate no foreign
 					 * address is known */
+#endif
 	int fp;				/* foreign port */
 {
 	if (la) {
 	    Lf->li[0].as = 1;
+#ifdef IN6ADDR_ANY_INIT
+	    Lf->li[0].af = af;
+#endif
 	    Lf->li[0].ia = *la;
 	    Lf->li[0].p = lp;
 	} else
 	    Lf->li[0].as = 0;
 	if (fa) {
 	    Lf->li[1].as = 1;
+#ifdef IN6ADDR_ANY_INIT
+	    Lf->li[1].af = af;
+#endif
 	    Lf->li[1].ia = *fa;
 	    Lf->li[1].p = fp;
 	} else
@@ -261,8 +277,14 @@
 /*
  * If network address matching has been selected, check both addresses.
  */
+#ifdef IN6ADDR_ANY_INIT
+	if ((Selflags & SELNA) && Nwad
+	&&  ((fa && is_nw_addr(af, (char *)fa, fp)) ||
+	     (la && is_nw_addr(af, (char *)la, lp))))
+#else
 	if ((Selflags & SELNA) && Nwad
 	&&  ((fa && is_nw_addr(fa, fp)) || (la && is_nw_addr(la, lp))))
+#endif
 	    Lf->sf |= SELNA;
 }
 
diff -uN local-orig/lsof_4.23/proto.h local-new/lsof_4.23/proto.h
--- local-orig/lsof_4.23/proto.h
+++ local-new/lsof_4.23/proto.h
@@ -84,16 +84,28 @@
 _PROTOTYPE(extern int enter_str_lst,(char *opt, char *s, struct str_lst **lp));
 _PROTOTYPE(extern int enter_uid,(char *u));
 _PROTOTYPE(extern int examine_lproc,(void));
+#ifdef IN6ADDR_ANY_INIT
+_PROTOTYPE(extern void ent_inaddr,(int af, struct in6_addr *la, int lp, struct in6_addr *fa, int fp));
+#else
 _PROTOTYPE(extern void ent_inaddr,(struct in_addr *la, int lp, struct in_addr *fa, int fp));
+#endif
 _PROTOTYPE(extern void Exit,(int xv)) exiting;
 _PROTOTYPE(extern void find_ch_ino,(void));
 _PROTOTYPE(extern void free_lproc,(struct lproc *lp));
 _PROTOTYPE(extern void gather_proc_info,(void));
+#ifdef IN6ADDR_ANY_INIT
+_PROTOTYPE(extern char *gethostnm,(int af, char *ia));
+#else
 _PROTOTYPE(extern char *gethostnm,(struct in_addr *ia));
+#endif
 _PROTOTYPE(extern void initialize,(void));
 _PROTOTYPE(extern int is_cmd_excl,(char *cmd, short *pss, short *sf));
 _PROTOTYPE(extern int is_file_sel,(struct lfile *lf));
+#ifdef IN6ADDR_ANY_INIT
+_PROTOTYPE(extern int is_nw_addr,(int af, char *ia, int p));
+#else
 _PROTOTYPE(extern int is_nw_addr,(struct in_addr *ia, int p));
+#endif
 _PROTOTYPE(extern int is_proc_excl,(int pid, int pgrp, UID_ARG uid, short *pss, short *sf));
 _PROTOTYPE(extern int is_readable,(char *path, int msg));
 _PROTOTYPE(extern int kread,(KA_T addr, char *buf, READLEN_T len));
diff -uN local-orig/lynx2-7-1/WWW/Library/Implementation/HTTCP.c local-new/lynx2-7-1/WWW/Library/Implementation/HTTCP.c
--- local-orig/lynx2-7-1/WWW/Library/Implementation/HTTCP.c
+++ local-new/lynx2-7-1/WWW/Library/Implementation/HTTCP.c
@@ -76,7 +76,7 @@
 */
 #ifdef SOCKS
 extern BOOLEAN socks_flag;
-PUBLIC unsigned long socks_bind_remoteAddr; /* for long Rbind */
+PUBLIC struct in6_addr socks_bind_remoteAddr; /* for long Rbind */
 #endif /* SOCKS */
 
 /* PUBLIC SockA HTHostAddress; */	/* The internet address of the host */
@@ -286,7 +286,7 @@
 }
 
 #ifndef DECNET  /* Function only used below for a trace message */
-/*	Produce a string for an Internet address
+/*	Produce a string for an IPv6 address
 **	----------------------------------------
 **
 **  On exit,
@@ -296,12 +296,9 @@
 PUBLIC CONST char * HTInetString ARGS1(
 	SockA*,		sin)
 {
-    static char string[16];
-    sprintf(string, "%d.%d.%d.%d",
-	    (int)*((unsigned char *)(&sin->sin_addr)+0),
-	    (int)*((unsigned char *)(&sin->sin_addr)+1),
-	    (int)*((unsigned char *)(&sin->sin_addr)+2),
-	    (int)*((unsigned char *)(&sin->sin_addr)+3));
+    static char string[64];
+
+    (void) inet_ntop(AF_INET6, &sin->sin6_addr, string, 64);
     return string;
 }
 #endif /* !DECNET */
@@ -342,7 +339,7 @@
     	*port++ = 0;		/* Chop off port */
         if (port[0] >= '0' && port[0] <= '9') {
 #ifdef unix
-	    sin->sin_port = htons(atol(port));
+	    sin->sin6_port = htons(atol(port));
 #else /* VMS */
 #ifdef DECNET
 	    sin->sdn_objnum = (unsigned char) (strtol(port, (char**)0 , 10));
@@ -353,7 +350,7 @@
 	} else {
 #ifdef SUPPRESS		/* 1. crashes!?!.  2. Not recommended */
 	    struct servent * serv = getservbyname(port, (char*)0);
-	    if (serv) sin->sin_port = serv->s_port;
+	    if (serv) sin->sin6_port = serv->s_port;
 	    else if (TRACE) fprintf(stderr, "TCP: Unknown service %s\n", port);
 #endif /* SUPPRESS */
 	}
@@ -389,6 +386,7 @@
     /*
     **  Parse host number if present.
     */  
+#ifdef GETHOSTBYNAME_IS_STUPID
     if (dotcount_ip == 3) {   /* Numeric node address: */
 #ifdef DGUX_OLD
 	sin->sin_addr.s_addr = inet_addr(host).s_addr;	/* See arpa/inet.h */
@@ -401,6 +399,7 @@
 #endif /* DGUX_OLD */
 	FREE(host);
     } else {		    /* Alphanumeric node name: */
+#endif
 #ifdef MVS	/* Oustanding problem with crash in MVS gethostbyname */
 	if (TRACE)
 	    fprintf(stderr, "HTTCP: Calling gethostbyname(%s)\n", host);
@@ -415,7 +414,7 @@
 	    /*
 	    **  Pipe, child pid, and status buffers.
 	    */
-	    int pfd[2], fpid, cstat, cst1;
+	    int pfd[2], fpid, cstat, cst1, a[4];
 
 	    pipe(pfd);
 
@@ -424,14 +423,14 @@
 		**  Child - for the long call.
 		*/
 		phost = gethostbyname(host);
-		cst1 = 0;
+		a[0] = a[1] = a[2] = a[3] = 0;
 		/*
 		**  Return value (or nulls).
 		*/
 		if (phost != NULL)
 		    write(pfd[1], phost->h_addr, phost->h_length);
 		else
-		    write(pfd[1], &cst1, 4);
+		    write(pfd[1], a, 16);
 		/*
 		**  Return an error code.
 		*/
@@ -476,15 +475,15 @@
 	    **  Read as much as we can - should be the address.
 	    */
 	    IOCTL(pfd[0], FIONREAD, &cstat);
-	    if (cstat < 4)
-	        cstat = read(pfd[0], (void *)&sin->sin_addr , 4);
+	    if (cstat < 16)
+	        cstat = read(pfd[0], (void *)&sin->sin6_addr , 16);
 	    else
-	        cstat = read(pfd[0], (void *)&sin->sin_addr , cstat);
+	        cstat = read(pfd[0], (void *)&sin->sin6_addr , cstat);
 	    close(pfd[0]);
 	    close(pfd[1]);
 	}
 
-	if (sin->sin_addr.s_addr == 0) {
+	if (IN6_IS_ADDR_UNSPECIFIED(&sin->sin6_addr)) {
 	    if (TRACE)
 	        fprintf(stderr, 
 		    "HTTPAccess: Can't find internet node name `%s'.\n",host);
@@ -523,20 +522,20 @@
 	*/
 	memcpy((void *)&sin->sin_addr, phost->h_addr, 4);
 #else
-	memcpy((void *)&sin->sin_addr, phost->h_addr, phost->h_length);
+	memcpy((void *)&sin->sin6_addr, phost->h_addr, phost->h_length);
 #endif /* VMS && CMU_TCP */
 #endif /* NSL_FORK */
+#ifdef GETHOSTBYNAME_IS_STUPID
     }
+#endif
+    if (TRACE) {
+	char v[64];
 
-    if (TRACE)
         fprintf(stderr,  
-		"TCP: Parsed address as port %d, IP address %d.%d.%d.%d\n",
-		(int)ntohs(sin->sin_port),
-		(int)*((unsigned char *)(&sin->sin_addr)+0),
-		(int)*((unsigned char *)(&sin->sin_addr)+1),
-		(int)*((unsigned char *)(&sin->sin_addr)+2),
-		(int)*((unsigned char *)(&sin->sin_addr)+3));
-
+		"TCP: Parsed address as port %d, IPv6 address %s\n",
+		(int)ntohs(sin->sin6_port),
+		inet_ntop(AF_INET6, &sin->sin6_addr, v, 64));
+    }
 #endif  /* Internet vs. Decnet */
 
     return 0;	/* OK */
@@ -624,16 +623,20 @@
 	int,		default_port, 
 	int *,		s)
 {
-    struct sockaddr_in soc_address;
-    struct sockaddr_in *sin = &soc_address;
+    struct sockaddr_in6 soc_address;
+    struct sockaddr_in6 *sin = &soc_address;
     int status;
     char *line = NULL;
 
     /*
     **  Set up defaults.
     */
-    sin->sin_family = AF_INET;
-    sin->sin_port = htons(default_port);
+#ifdef SIN6_LEN
+    sin->sin6_len = sizeof(*sin);
+#endif
+    sin->sin6_family = AF_INET6;
+    sin->sin6_flowinfo = 0;
+    sin->sin6_port = htons(default_port);
 
     /*
     **  Get node name and optional port number.
@@ -679,7 +682,7 @@
     /*
     **  Now, let's get a socket set up from the server for the data.
     */
-    *s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+    *s = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
    
     if (*s == -1) {
 	HTAlert("socket failed.");
@@ -717,7 +720,7 @@
 	/*
 	**  For long Rbind.
 	*/
-        socks_bind_remoteAddr = soc_address.sin_addr.s_addr;
+        socks_bind_remoteAddr = soc_address.sin6_addr;
     } else
 #endif /* SOCKS */
     status = connect(*s, (struct sockaddr*)&soc_address, sizeof(soc_address));
diff -uN local-orig/lynx2-7-1/WWW/Library/Implementation/HTTCP.h local-new/lynx2-7-1/WWW/Library/Implementation/HTTCP.h
--- local-orig/lynx2-7-1/WWW/Library/Implementation/HTTCP.h
+++ local-new/lynx2-7-1/WWW/Library/Implementation/HTTCP.h
@@ -27,7 +27,7 @@
 **                it is to be kept.
 */
 #ifdef __STDC__
-        extern const char * HTInetString(struct sockaddr_in* sin);
+        extern const char * HTInetString(struct sockaddr_in6* sin);
 #else
         extern char * HTInetString();
 #endif
@@ -51,7 +51,7 @@
 
 /*      Publicly accessible variables
 */
-/* extern struct sockaddr_in HTHostAddress; */
+/* extern struct sockaddr_in6 HTHostAddress; */
                         /* The internet address of the host */
                         /* Valid after call to HTHostName() */
 
@@ -88,7 +88,7 @@
 **               field is left unchanged in *sin.
 */
 #ifdef __STDC__
-        extern int HTParseInet(struct sockaddr_in * sin, CONST char * str);
+        extern int HTParseInet(struct sockaddr_in6 * sin, CONST char * str);
         /*!! had to change this to get it to compile. CTB */
 #else
         extern int HTParseInet();
diff -uN local-orig/lynx2-7-1/WWW/Library/Implementation/tcp.h local-new/lynx2-7-1/WWW/Library/Implementation/tcp.h
--- local-orig/lynx2-7-1/WWW/Library/Implementation/tcp.h
+++ local-new/lynx2-7-1/WWW/Library/Implementation/tcp.h
@@ -57,7 +57,7 @@
 #define GOT_PIPE
 #endif /* unix */
 
-typedef struct sockaddr_in SockA;  /* See netinet/in.h */
+typedef struct sockaddr_in6 SockA;  /* See netinet/in.h */
 
 
 #ifndef STDIO_H
@@ -553,6 +553,7 @@
 #include <arpa/inet.h>      /* Must be after netinet/in.h */
 #endif /* !__hpux */
 #include <netdb.h>
+#include <resolv.h>
 #endif  /* TCP includes */
 
 /*
diff -uN local-orig/lynx2-7-1/WWW/Library/Implementation/HTFTP.c local-new/lynx2-7-1/WWW/Library/Implementation/HTFTP.c
--- local-orig/lynx2-7-1/WWW/Library/Implementation/HTFTP.c
+++ local-new/lynx2-7-1/WWW/Library/Implementation/HTFTP.c
@@ -116,8 +116,8 @@
 
 typedef struct _connection {
     struct _connection *	next;	/* Link on list 	*/
-    u_long			addr;	/* IP address		*/
     int				socket;	/* Socket number for communication */
+    struct in6_addr		addr;	/* IPv6 address		*/
     BOOL			binary; /* Binary mode? */
 } connection;
 
@@ -155,7 +155,7 @@
 PRIVATE BOOLEAN HaveYears = FALSE; 
 #ifdef SOCKS
 extern BOOLEAN socks_flag;
-extern unsigned long socks_bind_remoteAddr;
+extern struct in6_addr socks_bind_remoteAddr;
 #endif /* SOCKS */
 extern char *personal_mail_address;
 
@@ -966,8 +966,8 @@
 */
 PRIVATE int get_listen_socket NOARGS
 {
-    struct sockaddr_in soc_address;	/* Binary network address */
-    struct sockaddr_in* sin = &soc_address;
+    struct sockaddr_in6 soc_address;	/* Binary network address */
+    struct sockaddr_in6* sin = &soc_address;
     int new_socket;			/* Will be master_socket */
     
     
@@ -981,7 +981,7 @@
 
 /*  Create internet socket
 */
-    new_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+    new_socket = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
 	
     if (new_socket < 0)
 	return HTInetStatus("socket for master socket");
@@ -991,8 +991,12 @@
     
 /*  Search for a free port.
 */
-    sin->sin_family = AF_INET;	    /* Family = internet, host order  */
-    sin->sin_addr.s_addr = INADDR_ANY; /* Any peer address */
+#ifdef SIN6_LEN
+    sin->sin6_len = sizeof(*sin);
+#endif
+    sin->sin6_family = AF_INET6;    /* Family = IPv6, host order  */
+    sin->sin6_flowinfo = 0;
+    sin->sin6_addr = in6addr_any;   /* Any peer address */
 #ifdef POLL_PORTS
     {
         unsigned short old_port_number = port_number;
@@ -1003,7 +1007,7 @@
 	    if (port_number == old_port_number) {
 		return HTInetStatus("bind");
 	    }
-	    soc_address.sin_port = htons(port_number);
+	    soc_address.sin6_port = htons(port_number);
 #ifdef SOCKS
 	    if (socks_flag)
 	        if ((status=Rbind(new_socket,
@@ -1046,7 +1050,7 @@
 	CTRACE(tfp, "HTFTP: This host is %s\n",
 	    HTInetString(sin));
 	
-	soc_address.sin_port = 0;	/* Unspecified: please allocate */
+	soc_address.sin6_port = 0;	/* Unspecified: please allocate */
 #ifdef SOCKS
 	if (socks_flag)
 	    status=Rbind(new_socket,
@@ -1081,7 +1085,7 @@
 #endif /* POLL_PORTS */
 
     CTRACE(tfp, "HTFTP: bound to port %d on %s\n",
-    		(int)ntohs(sin->sin_port),
+    		(int)ntohs(sin->sin6_port),
 		HTInetString(sin));
 
 #ifdef REPEAT_LISTEN
@@ -1094,14 +1098,39 @@
 /*	Now we must find out who we are to tell the other guy
 */
     (void)HTHostName(); 	/* Make address valid - doesn't work*/
-    sprintf(port_command, "PORT %d,%d,%d,%d,%d,%d%c%c",
-		    (int)*((unsigned char *)(&sin->sin_addr)+0),
-		    (int)*((unsigned char *)(&sin->sin_addr)+1),
-		    (int)*((unsigned char *)(&sin->sin_addr)+2),
-		    (int)*((unsigned char *)(&sin->sin_addr)+3),
-		    (int)*((unsigned char *)(&sin->sin_port)+0),
-		    (int)*((unsigned char *)(&sin->sin_port)+1),
+    if (IN6_IS_ADDR_V4MAPPED(&sin->sin6_addr)) {
+	sprintf(port_command, "PORT %d,%d,%d,%d,%d,%d%c%c",
+		    (int)*((unsigned char *)(&sin->sin6_addr)+12),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+13),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+14),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+15),
+		    (int)*((unsigned char *)(&sin->sin6_port)+0),
+		    (int)*((unsigned char *)(&sin->sin6_port)+1),
 		    CR, LF);
+    } else {
+	sprintf(port_command, "LPRT %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%c%c",
+		    6, 16,
+		    (int)*((unsigned char *)(&sin->sin6_addr)+0),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+1),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+2),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+3),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+4),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+5),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+6),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+7),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+8),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+9),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+10),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+11),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+12),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+13),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+14),
+		    (int)*((unsigned char *)(&sin->sin6_addr)+15),
+		    2,
+		    (int)*((unsigned char *)(&sin->sin6_port)+0),
+		    (int)*((unsigned char *)(&sin->sin6_port)+1),
+		    CR, LF);
+    }
 
 
 /*	Inform TCP that we will accept connections
@@ -3154,7 +3183,7 @@
 /*	Wait for the connection
 */
     {
-	struct sockaddr_in soc_address;
+	struct sockaddr_in6 soc_address;
         int	soc_addrlen=sizeof(soc_address);
 #ifdef SOCKS
 	if (socks_flag)
diff -uN local-orig/lynx2-7-1/src/LYMain.c local-new/lynx2-7-1/src/LYMain.c
--- local-orig/lynx2-7-1/src/LYMain.c
+++ local-new/lynx2-7-1/src/LYMain.c
@@ -453,6 +453,12 @@
      */
     atexit(free_lynx_globals);
 
+    /*
+     * Setup the DNS for IPv6.
+     */
+    res_init();
+    _res.options |= RES_USE_INET6;
+
 #ifdef LOCALE
     /*
      *  LOCALE support for international characters.
diff -uN local-orig/lynx2-7-1/utils/inews/clientlib.c local-new/lynx2-7-1/utils/inews/clientlib.c
--- local-orig/lynx2-7-1/utils/inews/clientlib.c
+++ local-new/lynx2-7-1/utils/inews/clientlib.c
@@ -178,7 +178,7 @@
 char	*machine;
 {
 	int	s;
-	struct	sockaddr_in sin;
+	struct	sockaddr_in6 sin;
 #ifndef EXCELAN
 	struct	servent *getservbyname(), *sp;
 	struct	hostent *gethostbyname(), *hp;
@@ -186,6 +186,7 @@
 	int	x = 0;
 	register char **cp;
 #endif h_addr
+	char	v[64];
 
 	if ((sp = getservbyname("nntp", "tcp")) ==  NULL) {
 		fprintf(stderr, "nntp/tcp: Unknown service.\n");
@@ -197,22 +198,22 @@
         * one stage further to allow nnn.nnn.nnn.nnn addresses if all else
         * fails.
         */
+       /* In fact gethostbyname knows literals... */
        if( (hp = gethostbyname( machine ) ) == NULL ) {
-               unsigned long inet_addr();
+               int inet_pton();
                static struct hostent def;
-               static struct in_addr defaddr;
+               static struct in6_addr defaddr;
                static char *alist[1];
                static char namebuf[ 256 ];
-               defaddr.s_addr = inet_addr( machine );
-               if( defaddr.s_addr != -1 ) {
+	       if( inet_pton( AF_INET6, machine, &defaddr ) > 0 ) {
                        strcpy( namebuf, machine );
                        def.h_name = namebuf;
 #ifdef h_addr
                        def.h_addr_list = alist;
 #endif
                        def.h_addr = (char *)&defaddr;
-                       def.h_length = sizeof( struct in_addr );
-                       def.h_addrtype = AF_INET;
+                       def.h_length = sizeof( struct in6_addr );
+                       def.h_addrtype = AF_INET6;
                        def.h_aliases = 0;
                        hp = &def;
                }
@@ -223,8 +224,11 @@
 	}
 
 	memset((char *) &sin, '\0', sizeof(sin));
-	sin.sin_family = hp->h_addrtype;
-	sin.sin_port = sp->s_port;
+#ifdef SIN6_LEN
+	sin.sin6_len = sizeof(sin);
+#endif
+	sin.sin6_family = hp->h_addrtype;
+	sin.sin6_port = sp->s_port;
 #else
 	memset((char *) &sin, '\0', sizeof(sin));
 	sin.sin_family = AF_INET;
@@ -251,14 +255,16 @@
 			perror("socket");
 			return (-1);
 		}
-	        memcpy(*cp, (char *)&sin.sin_addr, hp->h_length);
+	        memcpy(*cp, (char *)&sin.sin6_addr, hp->h_length);
 
 		if (x < 0)
-			fprintf(stderr, "trying %s\n", inet_ntoa(sin.sin_addr));
+			fprintf(stderr, "trying %s\n",
+				inet_ntop(AF_INET6, &sin.sin6_addr, v, 64));
 		x = connect(s, (struct sockaddr *)&sin, sizeof (sin));
 		if (x == 0)
 			break;
-                fprintf(stderr, "connection to %s: ", inet_ntoa(sin.sin_addr));
+                fprintf(stderr, "connection to %s: ",
+			inet_ntop(AF_INET6, &sin.sin6_addr, v, 64));
 		perror("");
 		(void) close(s);
 	}
diff -uN local-orig/lynx2-7-1/Makefile local-new/lynx2-7-1/Makefile
--- local-orig/lynx2-7-1/Makefile
+++ local-new/lynx2-7-1/Makefile
@@ -1,6 +1,14 @@
 ##makefile for lynx
 
 SHELL = /bin/sh
+PREFIX = /usr/local
+INSTALL = /usr/bin/install
+BINMODE = 555
+BINOWN = bin
+BINGRP = bin
+MANMODE = 444
+MANOWN = bin
+MANGRP = bin
 
 ##uncomment the next line if your make fails to set $(MAKE)
 #MAKE= make
@@ -14,18 +22,18 @@
 
 ##change the next line if you want lynx installed somewhere
 ##besides /usr/local/bin
-exec= /usr/local/bin
+exec= ${PREFIX}/bin
 
 ##change the next line if you want the lynx man file installed somewhere
 ##besides /usr/local/man/man1
-doc= /usr/local/man/man1
+doc= ${PREFIX}/man/man1
 
 ##change the next line if you want the lynx.cfg file installed somewhere
 ##besides /usr/local/lib
-cfg= /usr/local/lib
+cfg= ${PREFIX}/etc
 
-installbin= install -c -s -m 755
-installdoc= install -c -m 444
+installbin= ${INSTALL} -c -s -m ${BINMODE} -o ${BINOWN} -g ${BINGRP}
+installdoc= ${INSTALL} -c -m ${MANMODE} -o ${MANOWN} -g ${MANGRP}
 
 ##set the relative location of the WWW library Implementation directory,
 ##from this directory
@@ -271,7 +279,7 @@
 SITE_LYDEFS = $(DIR_LYDEFS) # Your defines here
 
 # Set SITE_DEFS to one or more of the defines for lynx below:
-SITE_DEFS = $(DIR_DEFS) # Your defines here
+SITE_DEFS = $(DIR_DEFS) -DLYNX_CFG_FILE='\"${PREFIX}/etc/lynx.cfg\"'
 
 # if you are compiling on a previously unsupported system, modify
 # this generic entry!!
diff -uN local-orig/mmm-0.41/mmm.sh local-new/mmm-0.41/mmm.sh
--- local-orig/mmm-0.41/mmm.sh
+++ local-new/mmm-0.41/mmm.sh
@@ -9,13 +9,13 @@
 # $ $MMM_MAIL -s subject address < msg_body
 # If left undefined, MMM will use the first "mail" command in the user's PATH
 # We suggest the following:
-if [ -f /bin/mail ]; then
-  MMM_MAIL=/bin/mail
+if [ -f /usr/bin/mail ]; then
+  MMM_MAIL=/usr/bin/mail
   export MMM_MAIL
 fi
 
 # CHECK: default proxy host. Can be overidden by users.
-proxy=www-proxy.domain
+proxy=www.imag.fr
 port=80
 
 # CHECK: MMMDIR should be the same as INSTALLLIBDIR in Makefile.config
diff -uN local-orig/altq-0.4.3/atm-tools/Makefile local-new/altq-0.4.3/atm-tools/Makefile
--- local-orig/altq-0.4.3/atm-tools/Makefile
+++ local-new/altq-0.4.3/atm-tools/Makefile
@@ -3,9 +3,9 @@
 TXCTL_OBJS=	pvctxctl.o
 SIF_OBJS=	pvcsif.o if_nameindex.o
 
-CFLAGS=	-g -Wall -static
+CFLAGS=	-g -Wall -static -DHAVE_IF_NAMEINDEX
 
-SYS_INCLUDES=	-I/usr/src/sys-altq
+SYS_INCLUDES=
 INCLUDES=	-I. $(SYS_INCLUDES)
 
 all: $(PROGS)
diff -uN local-orig/altq-0.4.3/cbq-tools/cbq_config.c local-new/altq-0.4.3/cbq-tools/cbq_config.c
--- local-orig/altq-0.4.3/cbq-tools/cbq_config.c
+++ local-new/altq-0.4.3/cbq-tools/cbq_config.c
@@ -89,6 +89,9 @@
 static int	cbq_class_cmd(char *);
 static int	cbq_filter_cmd(char *);
 static int	cbq_ctl_cmd(char *);
+#ifdef INET6
+static int	cbq_flow_cmd(char *);
+#endif
 
 /*
  * Globals
@@ -113,6 +116,9 @@
         /* order must be same as entries cmd_tab[].cmd_op below!! */
         OP_HELP = 1, OP_QUIT, 
 	OP_IFACE,	OP_CLASS,  OP_FILTER,
+#ifdef INET6
+	OP_FLOW,
+#endif
 	OP_CBQ,
         OP_NULL, OP_BUG
 };
@@ -131,6 +137,9 @@
 	{ "interface",	OP_IFACE,	" interface if_name [bandwidth bps] [sched_type]\n" },
 	{ "class",	OP_CLASS,	" class cbq if_name class_name parent [borrow borrow_class] [admission ctlload|none] [maxburst count] [minburst count] [packetsize bytes] [priority pri] [pbandwidth percent]\n" },
 	{ "filter",	OP_FILTER,	" filter if_name class_name dst [netmask #] dport src [netmask #] sport proto\n" },
+#ifdef INET6
+	{ "flow",	OP_FLOW,	" flow if_name class_name flow src [prefix length #] proto\n" },
+#endif
 	{ "cbq",	OP_CBQ,		" cbq if_name {enable|disable|acc enable|acc disable}\n" },
 	{ "bug",	OP_BUG,		" bug (On/Off)\n" },
 	{ "",		OP_NULL,	"" } /* MUST BE LAST IN CMD TABLE */
@@ -310,6 +319,11 @@
     case OP_FILTER:
 	rval = cbq_filter_cmd(cmdbuf);
 	break;
+#ifdef INET6
+    case OP_FLOW:
+	rval = cbq_flow_cmd(cmdbuf);
+	break;
+#endif
     case OP_CBQ:
 	rval = cbq_ctl_cmd(cmdbuf);
 	break;
@@ -790,6 +804,9 @@
     sscanf(w, "%x", (const char *)&protocol); 
 #endif
     sfilt.proto = protocol; 
+#ifdef INET6
+    sfilt.family = AF_INET;
+#endif
 
     /*
      * Add the filter.
@@ -803,6 +820,109 @@
     }
     return (1);
 }
+
+#ifdef INET6
+static int
+cbq_flow_cmd(char *cmdbuf) 
+{
+    char 	w[128], *cp = cmdbuf;
+    char 	*ifname, class_name[128];
+    cbq_filt_t	sfilt;
+    u_int	protocol;
+    int		ret;
+    
+    if (!get_ifname(&cp, &ifname)) {
+	log(LOG_WARNING, 0,
+	    "missing interface name in %s, line %d",
+	    configfile, line_no);
+	return (0);
+    }
+
+    if (!next_word(&cp, class_name)) {
+	log(LOG_WARNING, 0,
+	    "missing class name in %s, line %d",
+	    configfile, line_no);
+	return (0);
+    }
+
+    sfilt.splen6 = 128;
+
+    /*
+     * Get flow ID
+     */
+    if (!next_word(&cp, w)) {
+	log(LOG_WARNING, 0,
+	    "missing flow ID in %s, line %d",
+	    configfile, line_no);
+	return (0);
+    }
+
+    if (((sscanf(w, "%d", &protocol)) == 0) ||
+	(protocol == 0) ||
+	(protocol > 0xffffff)) {
+	log(LOG_WARNING, 0,
+	    "bad flow ID in %s, line %d",
+	    configfile, line_no);
+	return (0);
+    }
+    sfilt.flow6 = htonl(protocol);
+    
+    /*
+     * Get flow Source Address
+     */
+    if (!next_word(&cp, w)) {
+	log(LOG_WARNING, 0,
+	    "missing flow source address in %s, line %d",
+	    configfile, line_no);
+	return (0);
+    }
+
+    if (inet_pton(AF_INET6, (char *)w, sfilt.saddr6) <= 0) {
+	log(LOG_WARNING, 0,
+	    "bad flow source address in %s, line %d",
+	    configfile, line_no);
+	return (0);
+    }
+
+    if (EQUAL(w, "prefix length")) {
+	/*
+	 * flow source prefix length is specified.
+	 */
+	next_word(&cp, w);
+	if (((sscanf(w, "%d", &protocol)) == 0) || (protocol > 128)) {
+	    log(LOG_WARNING, 0,
+		"bad flow source prefix length in %s, line %d",
+		configfile, line_no);
+	    return (0);
+	}
+	sfilt.splen6 = protocol;
+    }
+
+    /*
+     * Get flow Protocol ID
+     */
+    if ((sscanf(w, "%d", &protocol)) == 0) {
+	log(LOG_WARNING, 0,
+	    "bad flow protocol in %s, line %d",
+	    configfile, line_no);
+	return (0);
+    }
+    sfilt.proto = protocol; 
+    sfilt.family = AF_INET6;
+
+    /*
+     * Add the filter.
+     */
+    ret = cbq_add_static_filter(ifname, class_name, &sfilt);
+    if (ret) {
+	log(LOG_WARNING, 0,
+	    "can't add filter to class '%s' on interface '%s'",
+	    class_name, ifname);
+	return (0);
+    }
+    return (1);
+}
+#endif
 
 static int
 cbq_ctl_cmd(char *cmdbuf)
diff -uN local-orig/altq-0.4.3/cbq-tools/ifspeed.c local-new/altq-0.4.3/cbq-tools/ifspeed.c
--- local-orig/altq-0.4.3/cbq-tools/ifspeed.c
+++ local-new/altq-0.4.3/cbq-tools/ifspeed.c
@@ -37,6 +37,7 @@
 #include <sys/param.h>
 #include <sys/time.h>
 #include <sys/socket.h>
+#include <sys/ioctl.h>
 #include <sys/sockio.h>
 #include <net/if.h>
 #include <netinet/in.h>
diff -uN local-orig/altq-0.4.3/cbq-tools/rsvp_cbq.c local-new/altq-0.4.3/cbq-tools/rsvp_cbq.c
--- local-orig/altq-0.4.3/cbq-tools/rsvp_cbq.c
+++ local-new/altq-0.4.3/cbq-tools/rsvp_cbq.c
@@ -1483,6 +1483,10 @@
 			ntoh16(fltr_add.cbq_filter.sport));
 		fprintf(stderr, "Filter IP Protocol: %d\n",
 			fltr_add.cbq_filter.proto);
+#ifdef INET6
+		fprintf(stderr, "Filter Address Family: %d\n",
+			fltr_add.cbq_filter.family);
+#endif
 #else /* sun */
 		fprintf(stderr, "%s: CBQ_ADD_FILTER, class.%x\n",
 			ifname, fltr_add.cbq_class_handle);
@@ -1544,6 +1548,12 @@
 			inet_ntoa(in_addr));
 		fprintf(stderr, "Filter Source Port: %d\n",
 			ntoh16(fltr_add.cbq_filter.sport));
+		fprintf(stderr, "Filter IP Protocol: 0x%x\n",
+			fltr_add.cbq_filter.proto);
+#ifdef INET6
+		fprintf(stderr, "Filter Address Family: 0x%x\n",
+			fltr_add.cbq_filter.family);
+#endif
 #else
 		fprintf(stderr, "%s: CBQ_ADD_FILTER, class.%x\n",
 			ifinfo->ifname, fltr_add.cbq_class_handle);
@@ -1555,9 +1565,9 @@
 			fltr_add.cbq_filter.saddr);
 		fprintf(stderr, "Filter Source Port: 0x%x\n",
 			fltr_add.cbq_filter.sport);
-#endif
 		fprintf(stderr, "Filter IP Protocol: 0x%x\n",
 			fltr_add.cbq_filter.proto);
+#endif
 		fprintf(stderr, "\n");
 	}
 
@@ -1747,6 +1757,9 @@
 	fl.dport = dest->d_session->sess4_port;
 	fl.dmask = 0xffffffff;
 	fl.proto = dest->d_session->sess4_prot;
+#ifdef INET6
+	fl.family = AF_INET;
+#endif
 #else
 	fl.daddr = hton32(dest->d_addr.s_addr);
 	fl.dport = hton16(dest->d_port); 
@@ -1811,6 +1824,9 @@
 	log(LOG_INFO, 0, "Source Addr = %x, Source Port = %x\n",
 		inet_ntoa(in_addr), filt->sport);
 	log(LOG_INFO, 0, "Protocol = %x\n", filt->proto);
+#ifdef INET6
+	log(LOG_INFO, 0, "Addr Fam = %x\n", filt->family);
+#endif
 #else /* sun */
 	int             i;
 
diff -uN local-orig/altq-0.4.3/cbq-tools/Makefile local-new/altq-0.4.3/cbq-tools/Makefile
--- local-orig/altq-0.4.3/cbq-tools/Makefile
+++ local-new/altq-0.4.3/cbq-tools/Makefile
@@ -6,9 +6,10 @@
 IFSPEED_OBJS=	ifspeed.o
 
 CC=	gcc
-CFLAGS=	-g -Wall -DALTQ -DCBQDAEMON -Dfreebsd -DDEBUG_CBQ=0x40 -DUSE_ATMPVC
+CFLAGS=	-g -Wall -DALTQ -DCBQDAEMON -Dfreebsd -DDEBUG_CBQ=0x40 \
+ -DUSE_ATMPVC -DINET6 -DHAVE_IF_NAMEINDEX
 
-SYS_INCLUDES=	-I/usr/src/sys-altq
+SYS_INCLUDES=
 INCLUDES=	-I. -I./cbqmonitor $(SYS_INCLUDES)
 
 all: $(PROGS)
diff -uN local-orig/altq-0.4.3/fifoq-tools/Makefile local-new/altq-0.4.3/fifoq-tools/Makefile
--- local-orig/altq-0.4.3/fifoq-tools/Makefile
+++ local-new/altq-0.4.3/fifoq-tools/Makefile
@@ -3,9 +3,9 @@
 FIFOQD_OBJS=	fifoqd.o
 STAT_OBJS=	fifoqstat.o
 
-CFLAGS=	-g -Wall -DALTQ
+CFLAGS=	-g -Wall -DALTQ -DINET6
 
-SYS_INCLUDES=	-I/usr/src/sys-altq
+SYS_INCLUDES=
 INCLUDES=	-I. $(SYS_INCLUDES)
 
 all: $(PROGS)
diff -uN local-orig/altq-0.4.3/red-tools/Makefile local-new/altq-0.4.3/red-tools/Makefile
diff -uN local-orig/altq-0.4.3/wfq-tools/Makefile local-new/altq-0.4.3/wfq-tools/Makefile
--- local-orig/altq-0.4.3/wfq-tools/Makefile
+++ local-new/altq-0.4.3/wfq-tools/Makefile
@@ -3,9 +3,9 @@
 WFQD_OBJS=	wfqd.o
 
 CC=	gcc
-CFLAGS=	-g -Wall -DALTQ
+CFLAGS=	-g -Wall -DALTQ -DINET6
 
-SYS_INCLUDES=	-I/usr/src/sys-altq
+SYS_INCLUDES=
 INCLUDES=	-I. $(SYS_INCLUDES)
 
 all: $(PROGS)
diff -uN local-orig/ocaml-1.07/otherlibs/unix/gethost.c local-new/ocaml-1.07/otherlibs/unix/gethost.c
--- local-orig/ocaml-1.07/otherlibs/unix/gethost.c
+++ local-new/ocaml-1.07/otherlibs/unix/gethost.c
@@ -24,17 +24,28 @@
 #include "socketaddr.h"
 #ifndef _WIN32
 #include <netdb.h>
+#ifdef HAS_INET6
+#include <resolv.h>
+#endif
 #endif
 
 static int entry_h_length;
 
 extern int socket_domain_table[];
 
+#ifdef HAS_INET6
+static value alloc_one_addr(char *a)
+{
+  bcopy(a, &sock_addr.s_inet.sin6_addr, entry_h_length);
+  return alloc_inet_addr(&sock_addr.s_inet.sin6_addr);
+}
+#else
 static value alloc_one_addr(char *a)
 {
   bcopy(a, &sock_addr.s_inet.sin_addr, entry_h_length);
   return alloc_inet_addr(sock_addr.s_inet.sin_addr.s_addr);
 }
+#endif
 
 static value alloc_host_entry(struct hostent *entry)
 {
@@ -62,6 +73,48 @@
   return res;
 }
 
+#ifdef HAS_INET6
+value unix_gethostbyaddr(value a)   /* ML */
+{
+  struct in6_addr addr;
+  struct hostent * entry;
+  u_long options;
+
+  bcopy(String_val(a), &addr, sizeof(addr));
+  if ((_res.options & RES_INIT) == 0)
+    (void) res_init();
+  enter_blocking_section();
+  options = _res.options;
+  _res.options |= RES_USE_INET6;
+  entry = gethostbyaddr((char *) &addr, sizeof(struct in6_addr), AF_INET6);
+  _res.options = options;
+  leave_blocking_section();
+  if (entry == (struct hostent *) NULL) raise_not_found();
+  return alloc_host_entry(entry);
+}
+
+value unix_gethostbyname(value name)   /* ML */
+{
+  char hostname[256];
+  struct hostent * entry;
+  u_long options;
+
+  if ((_res.options & RES_INIT) == 0)
+    (void) res_init();
+  strncpy(hostname, String_val(name), sizeof(hostname) - 1);
+  hostname[sizeof(hostname) - 1] = 0;
+  enter_blocking_section();
+  options = _res.options;
+  _res.options |= RES_USE_INET6;
+  entry = gethostbyname(hostname);
+  _res.options = options;
+  leave_blocking_section();
+  if (entry == (struct hostent *) NULL) raise_not_found();
+  return alloc_host_entry(entry);
+}
+
+#else
+
 value unix_gethostbyaddr(value a)   /* ML */
 {
   uint32 addr;
@@ -87,6 +140,7 @@
   return alloc_host_entry(entry);
 }
 
+#endif
 #else
 
 value unix_gethostbyaddr(value name)
diff -uN local-orig/ocaml-1.07/otherlibs/unix/select.c local-new/ocaml-1.07/otherlibs/unix/select.c
--- local-orig/ocaml-1.07/otherlibs/unix/select.c
+++ local-new/ocaml-1.07/otherlibs/unix/select.c
@@ -26,7 +26,7 @@
 
 #endif
 
-#ifdef __OpenBSD__
+#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
 #include <string.h>
 #endif
 
diff -uN local-orig/ocaml-1.07/otherlibs/unix/socket.c local-new/ocaml-1.07/otherlibs/unix/socket.c
--- local-orig/ocaml-1.07/otherlibs/unix/socket.c
+++ local-new/ocaml-1.07/otherlibs/unix/socket.c
@@ -20,7 +20,11 @@
 #include <sys/socket.h>
 
 int socket_domain_table[] = {
+#ifdef HAS_INET6
+  PF_UNIX, PF_INET6
+#else
   PF_UNIX, PF_INET
+#endif
 };
 
 int socket_type_table[] = {
diff -uN local-orig/ocaml-1.07/otherlibs/unix/socketaddr.c local-new/ocaml-1.07/otherlibs/unix/socketaddr.c
--- local-orig/ocaml-1.07/otherlibs/unix/socketaddr.c
+++ local-new/ocaml-1.07/otherlibs/unix/socketaddr.c
@@ -30,6 +30,15 @@
 union sock_addr_union sock_addr;
 int sock_addr_len;
 
+#ifdef HAS_INET6
+value alloc_inet_addr(struct in6_addr *a)
+{
+  value res;
+  res = alloc_string(sizeof(struct in6_addr));
+  bcopy((char *)a, String_val(res), sizeof(struct in6_addr));
+  return res;
+}
+#else
 value alloc_inet_addr(unsigned int a)
 {
   value res;
@@ -37,6 +46,7 @@
   GET_INET_ADDR(res) = a;
   return res;
 }
+#endif
 
 void get_sockaddr(value a)
 {
@@ -60,15 +70,31 @@
 #endif
   case 1:                       /* ADDR_INET */
     {
+#ifdef HAS_INET6
+      value address;
+#endif
       char * p;
       int n;
       for (p = (char *) &sock_addr.s_inet, n = sizeof(sock_addr.s_inet);
            n > 0; p++, n--)
         *p = 0;
+#ifdef HAS_INET6
+      sock_addr.s_inet.sin6_family = AF_INET6;
+#ifdef SIN6_LEN
+      sock_addr.s_inet.sin6_len = sizeof(struct sockaddr_in6);
+#endif
+      address = Field(a, 0);
+      bcopy(String_val(address),
+	    &sock_addr.s_inet.sin6_addr,
+	    sizeof(struct in6_addr));
+      sock_addr.s_inet.sin6_port = htons(Int_val(Field(a, 1)));
+      sock_addr_len = sizeof(struct sockaddr_in6);
+#else
       sock_addr.s_inet.sin_family = AF_INET;
       sock_addr.s_inet.sin_addr.s_addr = GET_INET_ADDR(Field(a, 0));
       sock_addr.s_inet.sin_port = htons(Int_val(Field(a, 1)));
       sock_addr_len = sizeof(struct sockaddr_in);
+#endif
       break;
     }
   }
@@ -88,6 +114,17 @@
       break;
     }
 #endif
+#ifdef HAS_INET6
+  case AF_INET6:
+    { value a = alloc_inet_addr(&sock_addr.s_inet.sin6_addr);
+      Begin_root (a);
+        res = alloc(2, 1);
+        Field(res,0) = a;
+        Field(res,1) = Val_int(ntohs(sock_addr.s_inet.sin6_port));
+      End_roots();
+      break;
+    }
+#else
   case AF_INET:
     { value a = alloc_inet_addr(sock_addr.s_inet.sin_addr.s_addr);
       Begin_root (a);
@@ -97,6 +134,7 @@
       End_roots();
       break;
     }
+#endif
   default:
     unix_error(EAFNOSUPPORT, "", Nothing);
   }
diff -uN local-orig/ocaml-1.07/otherlibs/unix/socketaddr.h local-new/ocaml-1.07/otherlibs/unix/socketaddr.h
--- local-orig/ocaml-1.07/otherlibs/unix/socketaddr.h
+++ local-new/ocaml-1.07/otherlibs/unix/socketaddr.h
@@ -21,7 +21,11 @@
 union sock_addr_union {
   struct sockaddr s_gen;
   struct sockaddr_un s_unix;
+#ifdef HAS_INET6
+  struct sockaddr_in6 s_inet;
+#else
   struct sockaddr_in s_inet;
+#endif
 };
 
 extern union sock_addr_union sock_addr;
@@ -29,6 +33,10 @@
 
 void get_sockaddr (value);
 value alloc_sockaddr (void);
+#ifdef HAS_INET6
+value alloc_inet_addr (struct in6_addr *);
+#else
 value alloc_inet_addr (unsigned int);
 
 #define GET_INET_ADDR(v) (*((uint32 *) (v)))
+#endif
diff -uN local-orig/ocaml-1.07/otherlibs/unix/strofaddr.c local-new/ocaml-1.07/otherlibs/unix/strofaddr.c
--- local-orig/ocaml-1.07/otherlibs/unix/strofaddr.c
+++ local-new/ocaml-1.07/otherlibs/unix/strofaddr.c
@@ -19,6 +19,22 @@
 
 #include "socketaddr.h"
 
+#ifdef HAS_INET6
+#include <string.h>
+#include <arpa/inet.h>
+
+value unix_string_of_inet_addr(value a) /* ML */
+{
+  struct in6_addr address;
+  char buf[INET6_ADDRSTRLEN];
+
+  bcopy(String_val(a), (char *) &address, sizeof(address));
+  (void) inet_ntop(AF_INET6, &address, buf, INET6_ADDRSTRLEN);
+  return copy_string(buf);
+}
+
+#else
+
 value unix_string_of_inet_addr(value a) /* ML */
 {
   struct in_addr address;
@@ -26,6 +42,7 @@
   return copy_string(inet_ntoa(address));
 }
 
+#endif
 #else
 
 value unix_string_of_inet_addr(value a)
diff -uN local-orig/ocaml-1.07/otherlibs/unix/addrofstr.c local-new/ocaml-1.07/otherlibs/unix/addrofstr.c
--- local-orig/ocaml-1.07/otherlibs/unix/addrofstr.c
+++ local-new/ocaml-1.07/otherlibs/unix/addrofstr.c
@@ -19,6 +19,29 @@
 
 #include "socketaddr.h"
 
+#ifdef HAS_INET6
+#include <arpa/inet.h>
+
+value unix_inet_addr_of_string(value s) /* ML */
+{
+  struct in6_addr address;
+  int cc, i;
+
+  for (i = 0; i < 16; i++)
+    address.s6_addr[i] = 0;
+  if (strcmp(String_val(s), "0.0.0.0") == 0)
+    return alloc_inet_addr(&address);
+  if ((cc = inet_pton(AF_INET6, String_val(s), &address)) <= 0) {
+    address.s6_addr[10] = 0xff;
+    address.s6_addr[11] = 0xff;
+    cc = inet_pton(AF_INET, String_val(s), &address.s6_addr[12]);
+  }
+  if (cc <= 0) failwith("inet_addr_of_string");
+  return alloc_inet_addr(&address);
+}
+
+#else
+
 value unix_inet_addr_of_string(value s) /* ML */
 {
   unsigned int address;
@@ -27,6 +50,7 @@
   return alloc_inet_addr(address);
 }
 
+#endif
 #else
 
 value unix_inet_addr_of_string(value s)
diff -uN local-orig/ocamltk41/site.config local-new/ocamltk41/site.config
--- local-orig/ocamltk41/site.config
+++ local-new/ocamltk41/site.config
@@ -1,12 +1,14 @@
 ## Location of Objective Caml Libraries
-OCAMLLIBDIR=/usr/local/lib/objective-caml
-# OCAMLLIBDIR=/usr/local/lib/ocaml
+# OCAMLLIBDIR=/usr/local/lib/objective-caml
+OCAMLLIBDIR=/usr/local/lib/ocaml
 
 ## Compilation and link flags for Tcl/Tk applications
 ## Preprocessor flags to find tcl.h and tk.h
 #CPPFLAGS=-I/home/cahors/furuse/sun/include
+CPPFLAGS="-I/usr/X11R6/include -I/usr/local/include/tcl7.6 -I/usr/local/include/tk4.2"
 ## ld flags to add path to libtcl*.* and libtk*.*
 #LDFLAGS=-L/home/cahors/furuse/sun/lib
+LDFLAGS=-L/usr/local/lib
 
 ## If you're building the japanised version of MMM, you must use the
 ## japanised versions of Tcl and Tk. The libraries are usually installed
diff -uN local-orig/rsvpd.rel4.2a3/apitools/Pm_parse.c local-new/rsvpd.rel4.2a3/apitools/Pm_parse.c
--- local-orig/rsvpd.rel4.2a3/apitools/Pm_parse.c
+++ local-new/rsvpd.rel4.2a3/apitools/Pm_parse.c
@@ -56,7 +56,9 @@
 #include "system.h"
 #endif
 
+#ifndef tolower
 int tolower(int);
+#endif
 int strcasecmp();
 
 /*
diff -uN local-orig/rsvpd.rel4.2a3/apitools/rtap_cmds.c local-new/rsvpd.rel4.2a3/apitools/rtap_cmds.c
--- local-orig/rsvpd.rel4.2a3/apitools/rtap_cmds.c
+++ local-new/rsvpd.rel4.2a3/apitools/rtap_cmds.c
@@ -132,7 +132,9 @@
 int		Do_rsvp_cmd(int, int);
 rapi_sid_t	rapi_rsvp_cmd(rapi_cmd_t *, int *);
 int		Get_Socket(struct sockaddr *);
+#ifndef tolower
 int		tolower(int);
+#endif
 void		rtap_hexmsg(int, int, net_addr *, u_char *, int);
 int		get_GPIfilter(int, area_t **, int);
 void		set_adspec_p(int, int, int, int);
diff -uN local-orig/rsvpd.rel4.2a3/rsvpd/config.h local-new/rsvpd.rel4.2a3/rsvpd/config.h
--- local-orig/rsvpd.rel4.2a3/rsvpd/config.h
+++ local-new/rsvpd.rel4.2a3/rsvpd/config.h
@@ -27,9 +27,9 @@
 #endif	/* (defined(__SVR4) || defined(__svr4__)) */
 #endif	/* sun */
 
-#ifdef	__FreeBSD__
+#if	(defined(__FreeBSD__) || defined(__NetBSD__))
 #define	freebsd
-#endif	/* __FreeBSD__ */
+#endif	/* (defined(__FreeBSD__) || defined(__NetBSD__)) */
 
 #ifdef sgi
 #define STANDARD_C_LIBRARY
diff -uN local-orig/rsvpd.rel4.2a3/rsvpd/rapi_fmt.c local-new/rsvpd.rel4.2a3/rsvpd/rapi_fmt.c
--- local-orig/rsvpd.rel4.2a3/rsvpd/rapi_fmt.c
+++ local-new/rsvpd.rel4.2a3/rsvpd/rapi_fmt.c
@@ -56,12 +56,9 @@
 #define _MACHINE_ENDIAN_H_ 1
 #endif
 
-#include "rsvp_socks.h"
-#include "rsvp_trans.h"
-#include "rsvp_types.h"
-#include "rsvp.h"
-#include "rsvp_specs.h"
+#include "rsvp_daemon.h"
 #include "rsvp_api.h"
+#include "rsvp_specs.h"
 
 void	rapi_fmt_flowspec(rapi_flowspec_t *, char *, int);
 void	rapi_fmt_tspec(rapi_tspec_t *, char *, int);
diff -uN local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_global.h local-new/rsvpd.rel4.2a3/rsvpd/rsvp_global.h
--- local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_global.h
+++ local-new/rsvpd.rel4.2a3/rsvpd/rsvp_global.h
@@ -94,6 +94,9 @@
 extern char		*Log_Event_Cause;
 extern int		 NoMroute;
 extern int		 NoUnicast;
+#if defined(SUNMOD) || defined(CBQ)
+extern int		Allow_Guaranteed;
+#endif /* SUNMOD */
 
 #endif	/* __MAIN__ */
 
diff -uN local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_key.c local-new/rsvpd.rel4.2a3/rsvpd/rsvp_key.c
--- local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_key.c
+++ local-new/rsvpd.rel4.2a3/rsvpd/rsvp_key.c
@@ -56,7 +56,9 @@
 void		MD5Init(MD5_CTX *, UINT4 *);
 void		MD5Update(MD5_CTX *, u_char *, u_int32_t);
 void		MD5Final(u_char *, MD5_CTX *);
+#ifndef tolower
 int		tolower(int);
+#endif
 
 /* Forward declarations
  */
diff -uN local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_main.c local-new/rsvpd.rel4.2a3/rsvpd/rsvp_main.c
--- local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_main.c
+++ local-new/rsvpd.rel4.2a3/rsvpd/rsvp_main.c
@@ -92,6 +92,17 @@
 extern net_addr		encap_mc_addr6;
 #endif	/* USE_IPV6 */
 
+#ifdef SOLARIS
+char *solconfigfile = "/etc/rsvpd.conf";
+char *stdconfigfile = "/etc/rsvpd.isi.conf";
+#endif
+#if defined(CBQ) && !defined(sun)
+char *solconfigfile = "/usr/local/etc/cbq.conf";
+#endif
+#if defined(SUNMOD) || defined(CBQ)
+int Allow_Guaranteed = 0;
+#endif
+
 /*
  *	Test facility variables
  */
@@ -249,6 +260,15 @@
 	while ((c = getopt(argc, argv, "Dd:l:t:R:")) != -1) {
 		switch (c) {
 
+#if defined(SUNMOD) || defined(CBQ)
+		case 'f':
+			solconfigfile = optarg;
+			break;
+
+		case 'g':
+			Allow_Guaranteed = 1;
+			break;
+#endif
 		case 'D':	/* -D => debug mode, i.e. do not daemonize */
 			Daemonize = 0;
 			break;
diff -uN local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_print.c local-new/rsvpd.rel4.2a3/rsvpd/rsvp_print.c
--- local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_print.c
+++ local-new/rsvpd.rel4.2a3/rsvpd/rsvp_print.c
@@ -55,11 +55,7 @@
 #define _MACHINE_ENDIAN_H_ 1
 #endif
 
-#include "rsvp_socks.h"
-#include "rsvp_trans.h"
-#include "rsvp_types.h"
-#include "rsvp.h"
-#include "rsvp_objs.h"
+#include "rsvp_daemon.h"
 
 #ifdef RSVP_TCPDUMP	/* tcpdump */
 #include "interface.h"
@@ -78,7 +74,9 @@
 void log(int, int, const char *, ...);
 #endif
 
+#ifndef Next_Object
 #define Next_Object(x)  (Object_header *)((char *) (x) + Obj_Length(x))
+#endif
 
        char *fmt_filtspec();
 extern char *fmt_flowspec();
diff -uN local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_socks.c local-new/rsvpd.rel4.2a3/rsvpd/rsvp_socks.c
--- local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_socks.c
+++ local-new/rsvpd.rel4.2a3/rsvpd/rsvp_socks.c
@@ -53,8 +53,11 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
-#include "rsvp_socks.h"
-#ifdef	__FreeBSD__
+#ifdef __NetBSD__
+#include <sys/sysctl.h>
+#endif
+#include "rsvp_daemon.h"
+#ifdef	freebsd
 #include <errno.h>
 #include <stdlib.h>
 #include <sys/sysctl.h>
@@ -63,7 +66,7 @@
 #ifdef	USE_IPV6
 #include <netinet/in6_var.h>
 #endif	/* USE_IPV6 */
-#endif	/* __FreeBSD__ */
+#endif	/* freebsd */
 
 #ifdef	sun
 extern int gethostname(char *,int);
@@ -104,9 +107,9 @@
 #define	_SIOCGIFADDR	SIOCGIFADDR
 #endif	/* USE_IPV6 */
 
-#ifndef	__FreeBSD__
+#ifndef	freebsd
 static int if_indextoprefix(unsigned int n);
-#endif	/* __FreeBSD__ */
+#endif	/* freebsd */
 static int if_indextoflags(unsigned int n);
 static unsigned int prefix(unsigned char *p,unsigned int n);
 
@@ -120,7 +123,7 @@
 static unsigned int maxindex = 0;
 static int once = TRUE;
 
-#ifdef	__FreeBSD__
+#ifdef	freebsd
 
 /*
  * Expand the compacted form of addresses as returned via the
@@ -276,7 +279,7 @@
     return(ifs);
 }
 
-#else	/* __FreeBSD__ */
+#else	/* freebsd */
 
 struct if_nameindex *
 if_nameindex()
@@ -313,7 +316,7 @@
 	return(ifs);
 }
 
-#endif	/* __FreeBSD__ */
+#endif	/* freebsd */
 
 void
 if_freenameindex(struct if_nameindex *p)
@@ -344,7 +347,7 @@
 	return(ifname);
 }
 
-#ifndef	__FreeBSD__
+#ifndef	freebsd
 
 const char *
 inet_ntop(int af,const void *src,char *dst,size_t size)
@@ -405,12 +408,12 @@
 	return(NULL);
 }
 
-#endif	/* __FreeBSD__ */
+#endif	/* freebsd */
 
 struct if_attributes *
 if_attributes(unsigned int n)
 {
-#ifdef	__FreeBSD__
+#ifdef	freebsd
 
 	int i,flags;
 	struct if_attributes *l;
@@ -444,7 +447,7 @@
 	}
 	return(ifap[n]);
 
-#else	/* __FreeBSD__ */
+#else	/* freebsd */
 
 	static struct if_attributes ret[2];
 
@@ -475,7 +478,7 @@
 
 	return(ret);
 
-#endif 	/* __FreeBSD__ */
+#endif 	/* freebsd */
 }
 
 unsigned int
@@ -503,7 +506,7 @@
 struct sockaddr *
 if_indextoaddr(unsigned int index,int af)
 {
-#ifdef	__FreeBSD__
+#ifdef	freebsd
 
 	struct sockaddr *s;
 	struct if_attributes *l;
@@ -515,7 +518,7 @@
 			return(s);
 	return(NULL);
 
-#else	/* __FreeBSD__ */
+#else	/* freebsd */
 
 	int fd;
 	static struct ifreq ifr;
@@ -554,10 +557,10 @@
 		return(NULL);
 	return((struct sockaddr *) &ifr.ifr_addr);
 
-#endif 	/* __FreeBSD__ */
+#endif 	/* freebsd */
 }
 
-#ifndef	__FreeBSD__
+#ifndef	freebsd
 
 static
 int
@@ -600,7 +603,7 @@
 
 }
 
-#endif	/* __FreeBSD__ */
+#endif	/* freebsd */
 
 static
 int
diff -uN local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_socks.h local-new/rsvpd.rel4.2a3/rsvpd/rsvp_socks.h
--- local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_socks.h
+++ local-new/rsvpd.rel4.2a3/rsvpd/rsvp_socks.h
@@ -66,7 +66,7 @@
 #define	INET_ADDRSTRLEN		sizeof("XXX.XXX.XXX.XXX")
 #endif	/* INET_ADDRSTRLEN */
 
-#if	!(defined(__FreeBSD__) && defined(HAS_IPV6))
+#if	!(defined(freebsd) && defined(HAS_IPV6))
 
 struct if_nameindex {
 	unsigned int if_index;
@@ -85,7 +85,7 @@
 
 extern struct hostent * gethostbyname2(const char *name,int af);
 
-#endif	/* !(defined(__FreeBSD__) && defined(HAS_IPV6)) */
+#endif	/* !(defined(freebsd) && defined(HAS_IPV6)) */
 
 /******************************************************************************
  *
@@ -126,7 +126,7 @@
  *
  *****************************************************************************/
 
-#ifdef	__FreeBSD__
+#ifdef	freebsd
 #define	NET_SOCKADDR_SIZE_IPv4(x) \
 	{ \
 		(x)->sin_len = sizeof(struct sockaddr_in); \
@@ -135,10 +135,10 @@
 	{ \
 		(x)->sin6_len = sizeof(struct sockaddr_in6); \
 	}
-#else	/* __FreeBSD__ */
+#else	/* freebsd */
 #define	NET_SOCKADDR_SIZE_IPv4(x)
 #define	NET_SOCKADDR_SIZE_IPv6(x)
-#endif	/* __FreeBSD__ */
+#endif	/* freebsd */
 
 #define NET_SOCKADDR_IPv4(x,addr)	NET_SOCKADDR_UDP_IPv4(x,addr,htons(0))
 #define	NET_SOCKADDR_UDP_IPv4(x,addr,port) { \
diff -uN local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_trans.c local-new/rsvpd.rel4.2a3/rsvpd/rsvp_trans.c
--- local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_trans.c
+++ local-new/rsvpd.rel4.2a3/rsvpd/rsvp_trans.c
@@ -46,9 +46,7 @@
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/sockio.h>
-#include <net/if.h>
 #include <netinet/in.h>
-#include <netinet/udp.h>
 #include <netdb.h>
 #include <arpa/inet.h>
 #include <sys/types.h>
@@ -63,11 +61,10 @@
 #include <stdlib.h>
 #include <fcntl.h>
 #include <signal.h>
-#ifdef	__FreeBSD__
+#include "rsvp_daemon.h"
+#ifdef	freebsd
 #include <net/if_dl.h>
-#endif	/* __FreeBSD__ */
-#include "rsvp_socks.h"
-#include "rsvp_trans.h"
+#endif	/* freebsd */
 
 #ifndef	IPPROTO_RSVP
 #define	IPPROTO_RSVP	46
@@ -111,10 +108,10 @@
  *	defined for RSVP.
  */
 
-#ifdef	__FreeBSD__
+#ifdef	freebsd
 #define	msg_accrights		msg_control
 #define	msg_accrightslen	msg_controllen
-#endif	/* __FreeBSD__ */
+#endif	/* freebsd */
 
 typedef int (*callback)(int);
 
diff -uN local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_unicast.c local-new/rsvpd.rel4.2a3/rsvpd/rsvp_unicast.c
--- local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_unicast.c
+++ local-new/rsvpd.rel4.2a3/rsvpd/rsvp_unicast.c
@@ -69,8 +69,6 @@
  * SUCH DAMAGE.
  */
 #include <errno.h>
-#include <net/if.h>
-#include <net/if.h>
 #include <net/if_dl.h>
 #include <net/route.h>
 #include <netinet/in.h>
diff -uN local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_var.h local-new/rsvpd.rel4.2a3/rsvpd/rsvp_var.h
--- local-orig/rsvpd.rel4.2a3/rsvpd/rsvp_var.h
+++ local-new/rsvpd.rel4.2a3/rsvpd/rsvp_var.h
@@ -566,6 +566,9 @@
 #define DEBUG_RSRR		0x08	/* Log multicast routes           */
 #define DEBUG_MCAST_STATE	0x10	/* Multicast RSVP state (to dmap) */
 #define DEBUG_TIMERS		0x20	/* Timer events */
+#if defined(SOLARIS) || defined(CBQ)
+#define	DEBUG_CBQ		0x40
+#endif
 #define DEBUG_ALL		0xff
 
 #define LOG_ALWAYS	0	/* special value for log severity level */
diff -uN local-orig/rsvpd.rel4.2a3/rsvpd/Makefile local-new/rsvpd.rel4.2a3/rsvpd/Makefile
--- local-orig/rsvpd.rel4.2a3/rsvpd/Makefile
+++ local-new/rsvpd.rel4.2a3/rsvpd/Makefile
@@ -14,7 +14,9 @@
 # "make clean" if you change one!
 #
 
-DEFINES = -DDEBUG -DSCHEDULE -DRTAP -DSECURITY -DSTATS -DRSVP_DIAGS #-DNO_IPV6 -DWORKAROUNDS -DISI_TEST
+#DEFINES = -DDEBUG -DSCHEDULE -DRTAP -DSECURITY -DSTATS -DRSVP_DIAGS #-DNO_IPV6 -DWORKAROUNDS -DISI_TEST
+DEFINES = -DDEBUG -DSCHEDULE -DRTAP -DSECURITY -DSTATS -DRSVP_DIAGS \
+-DCBQ -DUSE_ATMPVC -DHAVE_IF_NAMEINDEX
 
 CC = gcc
 CFLAGS = -g -Wall
@@ -35,8 +37,9 @@
 
 # Select Traffic Control adaptation module object
 #
-TCOBJS = tc_test.o rsvp_LLkern.o
+#TCOBJS = tc_test.o rsvp_LLkern.o
 ##TCOBJS = tc_isps.o
+TCOBJS = tc_cbq.o tc_cbqinit.o tc_cbqatm.o rsvp_LLkern.o
 
 RSVPOBJS = rsvp_debug.o rsvp_path.o rsvp_resv.o rsvp_diag.o rsvp_timer.o \
 	rsvp_err.o rsvp_main.o rsvp_mstat.o rsvp_api.o rsvp_rsrr.o \
diff -uN local-orig/rsvpd.rel4.2a2/tkrsvp/Imakefile local-new/rsvpd.rel4.2a2/tkrsvp/Imakefile
--- local-orig/rsvpd.rel4.2a2/tkrsvp/Imakefile
+++ local-new/rsvpd.rel4.2a2/tkrsvp/Imakefile
@@ -7,8 +7,8 @@
 XCOMM
 XCOMM Make sure the include files for your tk/tcl files are here
 XCOMM
-INCLUDES = -I/local/tcl/include -I$(RSVPDIR)
-LOCAL_LIBRARIES = -L$(TKLIB) -ltk -L$(TCLLIB) -ltcl -lX11 -ldl -L$(RSVPDIR) -lrsvp
+INCLUDES = -I/usr/local/include/tk4.2 -I$(RSVPDIR)
+LOCAL_LIBRARIES = -L$(TKLIB) -ltk42 -L$(TCLLIB) -ltcl76 -lX11 -L$(RSVPDIR) -lrsvp
 EXTRA_LOAD_FLAGS = -lm 
 
 XCOMM Indicate the correct paths for each of the following libraries
@@ -20,8 +20,9 @@
 XCOMM
 XCOMM LOCAL_LIBDIR = /usr/local/lib
 
-TCLLIB = /local/tcl/lib
-TKLIB = /local/tcl/lib
+XLIB = /usr/X11R6/lib
+TCLLIB = /usr/local/lib
+TKLIB = /usr/local/lib
 
 XCOMM
 XCOMM Define the following:
@@ -53,33 +54,33 @@
 tcl2c: tcl2c.c
 	$(CC) $(CFLAGS) -o tcl2c tcl2c.c
 
-tk.tcl: $(TCLLIB)/tk4.1/tk.tcl
+tk.tcl: $(TCLLIB)/tk4.2/tk.tcl
 	$(RM) $@
-	ln -s $(TCLLIB)/tk4.1/tk.tcl
+	ln -s $(TCLLIB)/tk4.2/tk.tcl
 
-menu.tcl: $(TCLLIB)/tk4.1/menu.tcl
+menu.tcl: $(TCLLIB)/tk4.2/menu.tcl
 	$(RM) $@
-	ln -s $(TCLLIB)/tk4.1/menu.tcl
+	ln -s $(TCLLIB)/tk4.2/menu.tcl
 
-button.tcl: $(TCLLIB)/tk4.1/button.tcl
+button.tcl: $(TCLLIB)/tk4.2/button.tcl
 	$(RM) $@
-	ln -s $(TCLLIB)/tk4.1/button.tcl
+	ln -s $(TCLLIB)/tk4.2/button.tcl
 
-entry.tcl: $(TCLLIB)/tk4.1/entry.tcl
+entry.tcl: $(TCLLIB)/tk4.2/entry.tcl
 	$(RM) $@
-	ln -s $(TCLLIB)/tk4.1/entry.tcl
+	ln -s $(TCLLIB)/tk4.2/entry.tcl
 
-dialog.tcl: $(TCLLIB)/tk4.1/dialog.tcl
+dialog.tcl: $(TCLLIB)/tk4.2/dialog.tcl
 	$(RM) $@
-	ln -s $(TCLLIB)/tk4.1/dialog.tcl
+	ln -s $(TCLLIB)/tk4.2/dialog.tcl
 
-listbox.tcl: $(TCLLIB)/tk4.1/listbox.tcl
+listbox.tcl: $(TCLLIB)/tk4.2/listbox.tcl
 	$(RM) $@
-	ln -s $(TCLLIB)/tk4.1/listbox.tcl
+	ln -s $(TCLLIB)/tk4.2/listbox.tcl
 
-bgerror.tcl: $(TCLLIB)/tk4.1/bgerror.tcl
+bgerror.tcl: $(TCLLIB)/tk4.2/bgerror.tcl
 	$(RM) $@
-	ln -s $(TCLLIB)/tk4.1/bgerror.tcl
+	ln -s $(TCLLIB)/tk4.2/bgerror.tcl
 
 tkrsvp_tcl.c:	tcl2c tkrsvp.tcl
 	$(RM) $@
diff -uN local-orig/rsvpd.rel4.2a2/tkrsvp/tkrsvp_proto.h local-new/rsvpd.rel4.2a2/tkrsvp/tkrsvp_proto.h
--- local-orig/rsvpd.rel4.2a2/tkrsvp/tkrsvp_proto.h
+++ local-new/rsvpd.rel4.2a2/tkrsvp/tkrsvp_proto.h
@@ -23,6 +23,7 @@
 #ifndef _TKRSVP_PROTO_H_
 #define _TKRSVP_PROTO_H_
 
+#ifndef _STDLIB_H_
 /* to make things happy */
 extern int fprintf( FILE * stream, char * format, ... );
 extern int fflush( FILE * stream );
@@ -38,7 +39,7 @@
 extern char * inet_ntoa( struct in_addr in );
 extern int strncasecmp( char * s1, char * s2, int n );
 extern int getdtablesize( );
-
+#endif
 
 /* Things I define */
 extern int QuitCmd( ClientData clientData, Tcl_Interp * interp, int argc,
