---------------------
PatchSet 4693 
Date: 2007/06/03 12:14:41
Author: amosjeffries
Branch: squid3-ipv6
Tag: (none) 
Log:
Fix connection failure problems.
Roll conversion into several more request-chain areas.

Members: 
	NOTES-IPv6:1.1.2.29->1.1.2.30 
	include/IPAddress.h:1.1.2.20->1.1.2.21 
	lib/IPAddress.cc:1.1.2.45->1.1.2.46 
	lib/tests/testIPAddress.cc:1.1.2.9->1.1.2.10 
	src/ACLARP.cc:1.9.4.9->1.9.4.10 
	src/ConnectionDetail.h:1.3.8.2->1.3.8.3 
	src/PeerSelectState.h:1.1.12.3->1.1.12.4 
	src/cache_cf.cc:1.40.2.28->1.40.2.29 
	src/client_db.cc:1.5.4.12->1.5.4.13 
	src/client_side.cc:1.68.2.32->1.68.2.33 
	src/client_side_reply.cc:1.57.4.18->1.57.4.19 
	src/client_side_request.cc:1.33.4.19->1.33.4.20 
	src/comm.cc:1.47.2.33->1.47.2.34 
	src/fd.cc:1.10.4.3->1.10.4.4 
	src/fde.h:1.7.8.4->1.7.8.5 
	src/forward.cc:1.35.4.24->1.35.4.25 
	src/ftp.cc:1.26.2.25->1.26.2.26 
	src/icp_v2.cc:1.17.8.17->1.17.8.18 
	src/ipcache.cc:1.9.2.27->1.9.2.28 
	src/neighbors.cc:1.23.4.20->1.23.4.21 
	src/peer_digest.cc:1.11.4.10->1.11.4.11 
	src/peer_select.cc:1.9.4.11->1.9.4.12 
	src/protos.h:1.48.4.24->1.48.4.25 
	src/structs.h:1.66.2.21->1.66.2.22 
	src/tools.cc:1.22.2.18->1.22.2.19 

Index: squid3/NOTES-IPv6
===================================================================
RCS file: /cvsroot/squid-sf//squid3/Attic/NOTES-IPv6,v
retrieving revision 1.1.2.29
retrieving revision 1.1.2.30
diff -u -r1.1.2.29 -r1.1.2.30
--- squid3/NOTES-IPv6	31 May 2007 10:51:04 -0000	1.1.2.29
+++ squid3/NOTES-IPv6	3 Jun 2007 12:14:41 -0000	1.1.2.30
@@ -1,4 +1,4 @@
-$Id: NOTES-IPv6,v 1.1.2.29 2007/05/31 10:51:04 amosjeffries Exp $
+$Id: NOTES-IPv6,v 1.1.2.30 2007/06/03 12:14:41 amosjeffries Exp $
 
 KNOWN BUGS:
 
@@ -8,20 +8,36 @@
           Solved for all known events now, but this may reccur at any time
           until conversion is completed.
 
+PROBLEM: Sockets created with IPv4 'family' cannot be use for IPv6 anywhere
+	Likewise ones opened for IPv6 on split-stack systems cannot be used for IPv4.
+	The system that allocates pre-opened sockets to connections needs to
+	be modified such that it records the family of a socket and checks the
+	client addr family matches the socket family before allocating it.
+
+NP: have modified fde to store the sock_family a socket was allocated with.
+    Also GetAddrInfo to specifiy needed protocol formatting of an addrinfo
+    this will still fail retrieving AF_INET of an IPv6-pure destination.
+
+
+PROBLEM Segmentation Fault retrieving NtoA of address.
+Stack Trace:
+#3  0x08089301 in xassert (msg=0x814fa6a "false", file=0x8156cb0 "IPAddress.cc", line=893) at debug.cc:569
+#4  0x08129873 in IPAddress::NtoA (this=0x8560b28, buf=0xbf8a0d41 "", blen=75, force=None) at IPAddress.cc:893
+#5  0x08070d7f in clientdbEstablished (addr=@0x8560b28, delta=-1) at client_db.cc:153
+#6  0x08076c71 in ConnStateData::close (this=0x8560b08) at client_side.cc:602
+#7  0x08105a7d in commCallCloseHandlers (fd=19) at comm.cc:1472
+#8  0x0810a240 in _comm_close (fd=19, file=0x8135937 "client_side.cc", line=2638) at comm.cc:1647
+#9  0x0807194b in requestTimeout (fd=19, data=0x8560b08) at client_side.cc:2638
+#10 0x0810a72a in checkTimeouts () at comm.cc:2124
+#11 0x0810a88d in CommSelectEngine::checkEvents (this=0xbf8b0ffc, timeout=10) at comm.cc:2595
+#12 0x08091611 in EventLoop::checkEngine (this=0xbf8b0fbc, engine=0xbf8b0ffc, primary=true) at EventLoop.cc:50
+#13 0x080917aa in EventLoop::runOnce (this=0xbf8b0fbc) at EventLoop.cc:124
+#14 0x080918da in EventLoop::run (this=0xbf8b0fbc) at EventLoop.cc:100
+#15 0x080cb01e in main (argc=4, argv=0xbf8b10b4) at main.cc:1315
 
-PROBLEM: connection to parent proxy fails:
+(repeated twice so far)
 
-2007/05/31 22:36:02.741| ConnectSateData::connect: to 192.168.0.14:3128
-2007/05/31 22:36:02.741| commConnectCallback: FD 16, data 0x855bab8
-2007/05/31 22:36:02.741| comm_remove_close_handler: FD 16, handler=1, data=0x856feb0
-2007/05/31 22:36:02.741| commSetTimeout: FD 16 timeout -1
-2007/05/31 22:36:02.741| fwdFail: ERR_CONNECT_FAIL "Service Unavailable"
-2007/05/31 22:36:02.741| TCP connection to proxy.treenet.co.nz/3128 failed
-2007/05/31 22:36:02.741| TCP connection to proxy.treenet.co.nz/3128 dead
-2007/05/31 22:36:02.741| comm_close: FD 16
-
-
-cache.log lines detected showing problems:
+cache.log lines detected showing possible problems:
      (after a request for http://[2001:200:0:8002:203:47ff:fea5:3085]/ )
 
 			 commio_call_callback: called for 13
Index: squid3/include/IPAddress.h
===================================================================
RCS file: /cvsroot/squid-sf//squid3/include/Attic/IPAddress.h,v
retrieving revision 1.1.2.20
retrieving revision 1.1.2.21
diff -u -r1.1.2.20 -r1.1.2.21
--- squid3/include/IPAddress.h	27 May 2007 12:52:45 -0000	1.1.2.20
+++ squid3/include/IPAddress.h	3 Jun 2007 12:14:41 -0000	1.1.2.21
@@ -1,6 +1,6 @@
 
 /*
- * $Id: IPAddress.h,v 1.1.2.20 2007/05/27 12:52:45 amosjeffries Exp $
+ * $Id: IPAddress.h,v 1.1.2.21 2007/06/03 12:14:41 amosjeffries Exp $
  *
  * DEBUG: section 14    IP Storage and Handling
  * AUTHOR: Amos Jeffries
@@ -292,13 +292,25 @@
     /**
      *  Get RFC 3493 addrinfo structure from the IPAddress data
      *  for protocol-neutral socket operations.
-     *  Clears the structure given then fills all fields with default values
-     *  for a TCP streaming socket. For use with UDP datagrams MUST override
-     *  these default settings. Some situations may also require an actual call
-     *  to the system getaddrinfo() to pull relevant OS details for the socket.
+     *  Should be passed a NULL pointer of type struct addrinfo* it will
+     *  allocate memory for teh structures involved. (see FreeAddrInfo to clear).
+     *  Defaults to a TCP streaming socket, if other values (such as UDP) are needed
+     *  the caller MUST override these default settings.
+     *  Some situations may also require an actual call to the system getaddrinfo()
+     *  to pull relevant OS details for the socket.
+     *
+     *  IPAddress allocated objects MUST be estructed by IPAddress::FreeAddrInfo
+     *  System getaddrinfo() allocated objects MUST be freed with system freeaddrinfo()
+     *
      * \param ai structure to be filled out.
+     * \param force a specific sockaddr type is needed. default: don't care.
      */
-    void GetAddrInfo(struct addrinfo &ai) const;
+    void GetAddrInfo(struct addrinfo *&ai, int force = AF_UNSPEC) const;
+
+    /**
+     *  Equivalent to the sysem call freeaddrinfo() but for IPAddress allocated data
+     */
+    void FreeAddrInfo(struct addrinfo *&ai) const;
 
 public:
     /* FIXME: When C => C++ conversion is done will be fully private.
Index: squid3/lib/IPAddress.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/lib/Attic/IPAddress.cc,v
retrieving revision 1.1.2.45
retrieving revision 1.1.2.46
diff -u -r1.1.2.45 -r1.1.2.46
--- squid3/lib/IPAddress.cc	3 Jun 2007 04:48:40 -0000	1.1.2.45
+++ squid3/lib/IPAddress.cc	3 Jun 2007 12:14:42 -0000	1.1.2.46
@@ -1,6 +1,6 @@
 
 /*
- * $Id: IPAddress.cc,v 1.1.2.45 2007/06/03 04:48:40 amosjeffries Exp $
+ * $Id: IPAddress.cc,v 1.1.2.46 2007/06/03 12:14:42 amosjeffries Exp $
  *
  * DEBUG: section 14   IP Storage and Handling
  * AUTHOR: Amos Jeffries
@@ -710,53 +710,63 @@
     return true;
 }
 
-void IPAddress::GetAddrInfo(struct addrinfo &dst) const
+void IPAddress::GetAddrInfo(struct addrinfo *&dst, int force) const
 {
-    memset(&dst, 0, sizeof(struct addrinfo));
+    if(dst == NULL) {
+        dst = new addrinfo;
+    }
+
+    memset(dst, 0, sizeof(struct addrinfo));
 
     // set defaults
-    dst.ai_flags = AI_NUMERICHOST;
-    if(dst.ai_socktype == 0)
-      dst.ai_socktype = SOCK_STREAM;
-
-    if(dst.ai_socktype == SOCK_STREAM  // implies TCP
-       && dst.ai_protocol == 0)
-        dst.ai_protocol = IPPROTO_TCP;
-
-    if(dst.ai_socktype == SOCK_DGRAM  // implies UDP
-       && dst.ai_protocol == 0)
-        dst.ai_protocol = IPPROTO_UDP;
-
-    /* FIXME INET6 : for Split-Stack systems
-     *   some way needs to be made to open two ports (one v4 and one v6)
-     *   for each listener service. DNS needs a UDP port at the very least
-     *   and any ports configured with ::/0.0.0.0 as listener.
-     *
-     *   For now enable Dual-Stack systems by prefering an IPv6 dual-use port
-     */
-#if USE_IPV6
-    if( IsIPv6() ) {
-        dst.ai_addr = (struct sockaddr*)new sockaddr_in6;
-        GetSockAddr(*((struct sockaddr_in6*)dst.ai_addr));
-        dst.ai_addrlen = sizeof(struct sockaddr_in6);
+    dst->ai_flags = AI_NUMERICHOST;
+    if(dst->ai_socktype == 0)
+      dst->ai_socktype = SOCK_STREAM;
+
+    if(dst->ai_socktype == SOCK_STREAM  // implies TCP
+       && dst->ai_protocol == 0)
+        dst->ai_protocol = IPPROTO_TCP;
+
+    if(dst->ai_socktype == SOCK_DGRAM  // implies UDP
+       && dst->ai_protocol == 0)
+        dst->ai_protocol = IPPROTO_UDP;
+
+#if USE_IPV6
+    if( force==AF_INET6 || force == AF_UNSPEC && IsIPv6() ) {
+        dst->ai_addr = (struct sockaddr*)new sockaddr_in6;
+        memset(dst->ai_addr,0,sizeof(struct sockaddr_in6));
+        GetSockAddr(*((struct sockaddr_in6*)dst->ai_addr));
+        dst->ai_addrlen = sizeof(struct sockaddr_in6);
 
-        dst.ai_family = ((struct sockaddr_in6*)dst.ai_addr)->sin6_family;
-        dst.ai_protocol = IPPROTO_IPV6;
+        dst->ai_family = ((struct sockaddr_in6*)dst->ai_addr)->sin6_family;
+        dst->ai_protocol = IPPROTO_IPV6;
     }
     else
 #endif
-    if( IsIPv4() ) {
-        dst.ai_addr = (struct sockaddr*)new sockaddr_in;
-        GetSockAddr(*((struct sockaddr_in*)dst.ai_addr));
-        dst.ai_addrlen = sizeof(struct sockaddr_in);
+    if( force == AF_INET || force == AF_UNSPEC && IsIPv4() ) {
+        dst->ai_addr = (struct sockaddr*)new sockaddr_in;
+        memset(dst->ai_addr,0,sizeof(struct sockaddr_in));
+        GetSockAddr(*((struct sockaddr_in*)dst->ai_addr));
+        dst->ai_addrlen = sizeof(struct sockaddr_in);
 
-        dst.ai_family = ((struct sockaddr_in*)dst.ai_addr)->sin_family;
+        dst->ai_family = ((struct sockaddr_in*)dst->ai_addr)->sin_family;
     }
     else {
         assert(false);
     }
 }
 
+void IPAddress::FreeAddrInfo(struct addrinfo *&ai) const
+{
+    if(ai == NULL) return;
+    if(ai->ai_addr) delete ai->ai_addr;
+    ai->ai_addr = NULL;
+    ai->ai_addrlen = 0;
+    // NP: name fields are NOT allocated at present.
+    delete ai;
+    ai = NULL;
+}
+
 int IPAddress::matchIPAddr(const IPAddress &rhs) const
 {
     unsigned int slen = sizeof(m_SocketAddr.sin6_addr);
Index: squid3/lib/tests/testIPAddress.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/lib/tests/Attic/testIPAddress.cc,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -r1.1.2.9 -r1.1.2.10
--- squid3/lib/tests/testIPAddress.cc	27 May 2007 12:52:45 -0000	1.1.2.9
+++ squid3/lib/tests/testIPAddress.cc	3 Jun 2007 12:14:45 -0000	1.1.2.10
@@ -558,7 +558,7 @@
 testIPAddress::testAddrInfo()
 {
     struct addrinfo *expect;
-    struct addrinfo ipval;
+    struct addrinfo *ipval = NULL;
     struct addrinfo hints;
 
     memset(&hints, 0, sizeof(struct addrinfo));
@@ -578,16 +578,16 @@
     printf("\nADDRINFO: %04x  %04x %04x  %04x  %04x  %04x  ",
 		  p[0],p[1],p[2],p[3],p[4],p[5] );
 
-    p = (unsigned int*)&ipval;
+    p = (unsigned int*)ipval;
     printf("\nADDRINFO: %04x  %04x %04x  %04x  %04x  %04x  ",
 		  p[0],p[1],p[2],p[3],p[4],p[5] );
     printf("\n");
 
     // check the addrinfo object core. (BUT not the two ptrs at the tail)
-    CPPUNIT_ASSERT( memcmp( expect, &ipval, sizeof(struct addrinfo)-(sizeof(void*)*3) ) == 0 );
+    CPPUNIT_ASSERT( memcmp( expect, ipval, sizeof(struct addrinfo)-(sizeof(void*)*3) ) == 0 );
     // check the sockaddr it points to.
-    CPPUNIT_ASSERT_EQUAL( expect->ai_addrlen, ipval.ai_addrlen );
-    CPPUNIT_ASSERT( memcmp( expect, &ipval, expect->ai_addrlen ) == 0 );
+    CPPUNIT_ASSERT_EQUAL( expect->ai_addrlen, ipval->ai_addrlen );
+    CPPUNIT_ASSERT( memcmp( expect, ipval, expect->ai_addrlen ) == 0 );
 }
 
 void
Index: squid3/src/ACLARP.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/ACLARP.cc,v
retrieving revision 1.9.4.9
retrieving revision 1.9.4.10
diff -u -r1.9.4.9 -r1.9.4.10
--- squid3/src/ACLARP.cc	29 Apr 2007 05:47:32 -0000	1.9.4.9
+++ squid3/src/ACLARP.cc	3 Jun 2007 12:14:45 -0000	1.9.4.10
@@ -1,5 +1,5 @@
 /*
- * $Id: ACLARP.cc,v 1.9.4.9 2007/04/29 05:47:32 amosjeffries Exp $
+ * $Id: ACLARP.cc,v 1.9.4.10 2007/06/03 12:14:45 amosjeffries Exp $
  *
  * DEBUG: section 28    Access Control
  * AUTHOR: Duane Wessels
@@ -225,6 +225,13 @@
 int
 ACLARP::match(ACLChecklist *checklist)
 {
+    /* IPv6 does not do ARP */
+    if(!c.IsIPv4())
+    {
+        debugs(14, 3, "ACLARP::match: IPv4 Required for ARP Lookups. Skipping " << c );
+        return 0;
+    }
+
     return aclMatchArp(&data, checklist->src_addr);
 }
 
@@ -260,14 +267,6 @@
      * name first. If that does not succeed, the try each interface
      * in turn
      */
-#if USE_IPV6
-    /* IPv6 does not do ARP */
-    if(!c.IsIPv4())
-    {
-        debugs(14, 3, "aclMatchArp: IPv4 Required for ARP Lookups. Skipping " << c );
-        return 0;
-    }
-#endif
 
     /*
      * Set up structures for ARP lookup with blank interface name
@@ -403,15 +402,6 @@
 
     SplayNode<acl_arp_data *> **Top = dataptr;
 
-#if USE_IPV6
-    /* IPv6 does not do ARP */
-    if(!c.IsIPv4())
-    {
-        debug(14, 3, "aclMatchArp: IPv4 Required for ARP Lookups. Skipping " << c );
-        return 0;
-    }
-#endif
-
     /*
     * Set up structures for ARP lookup with blank interface name
     */
@@ -472,15 +462,6 @@
 
     struct sockaddr_dl *sdl;
 
-#if USE_IPV6
-    /* IPv6 does not do ARP */
-    if(!c.IsIPv4())
-    {
-        debug(14, 3, "aclMatchArp: IPv4 Required for ARP Lookups. Skipping " << c );
-        return 0;
-    }
-#endif
-
     /*
     * Set up structures for ARP lookup with blank interface name
     */
@@ -582,15 +563,6 @@
 
     memset(&arpReq, '\0', sizeof(arpReq));
 
-#if USE_IPV6
-    /* IPv6 does not do ARP */
-    if(!c.IsIPv4())
-    {
-        debug(14, 3, "aclMatchArp: IPv4 Required for ARP Lookups. Skipping " << c );
-        return 0;
-    }
-#endif
-
     /* Get size of Windows ARP table */
     if (GetIpNetTable(NetTable, &ipNetTableLen, FALSE) != ERROR_INSUFFICIENT_BUFFER) {
         debugs(28, 0, "Can't estimate ARP table size!");
Index: squid3/src/ConnectionDetail.h
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/ConnectionDetail.h,v
retrieving revision 1.3.8.2
retrieving revision 1.3.8.3
diff -u -r1.3.8.2 -r1.3.8.3
--- squid3/src/ConnectionDetail.h	12 Apr 2007 12:44:48 -0000	1.3.8.2
+++ squid3/src/ConnectionDetail.h	3 Jun 2007 12:14:45 -0000	1.3.8.3
@@ -1,5 +1,5 @@
 /*
- * $Id: ConnectionDetail.h,v 1.3.8.2 2007/04/12 12:44:48 amosjeffries Exp $
+ * $Id: ConnectionDetail.h,v 1.3.8.3 2007/06/03 12:14:45 amosjeffries Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Robert Collins
@@ -37,6 +37,8 @@
 #ifndef _SQUIDCONNECTIONDETAIL_H_
 #define _SQUIDCONNECTIONDETAIL_H_
 
+#include "IPAddress.h"
+
 class ConnectionDetail
 {
 
@@ -44,9 +46,9 @@
 
     ConnectionDetail();
 
-    struct sockaddr_in me;
+    IPAddress me;
 
-    struct sockaddr_in peer;
+    IPAddress peer;
 };
 
 #endif
Index: squid3/src/PeerSelectState.h
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/PeerSelectState.h,v
retrieving revision 1.1.12.3
retrieving revision 1.1.12.4
diff -u -r1.1.12.3 -r1.1.12.4
--- squid3/src/PeerSelectState.h	5 Apr 2007 06:15:13 -0000	1.1.12.3
+++ squid3/src/PeerSelectState.h	3 Jun 2007 12:14:45 -0000	1.1.12.4
@@ -1,6 +1,6 @@
 
 /*
- * $Id: PeerSelectState.h,v 1.1.12.3 2007/04/05 06:15:13 amosjeffries Exp $
+ * $Id: PeerSelectState.h,v 1.1.12.4 2007/06/03 12:14:45 amosjeffries Exp $
  *
  * AUTHOR: Robert Collins
  *
@@ -38,6 +38,7 @@
 
 #include "cbdata.h"
 #include "PingData.h"
+#include "IPAddress.h"
 
 class ps_state
 {
@@ -61,9 +62,9 @@
      * reference the peer structure.
      */
 
-    struct sockaddr_in first_parent_miss;
+    IPAddress first_parent_miss;
 
-    struct sockaddr_in closest_parent_miss;
+    IPAddress closest_parent_miss;
     /*
      * ->hit and ->secho can be peer* because they should only be
      * accessed during the thread when they are set
Index: squid3/src/cache_cf.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/cache_cf.cc,v
retrieving revision 1.40.2.28
retrieving revision 1.40.2.29
diff -u -r1.40.2.28 -r1.40.2.29
--- squid3/src/cache_cf.cc	30 May 2007 05:06:07 -0000	1.40.2.28
+++ squid3/src/cache_cf.cc	3 Jun 2007 12:14:45 -0000	1.40.2.29
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.40.2.28 2007/05/30 05:06:07 amosjeffries Exp $
+ * $Id: cache_cf.cc,v 1.40.2.29 2007/06/03 12:14:45 amosjeffries Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -622,9 +622,7 @@
         https_port_list *s;
 
         for (s = Config.Sockaddr.https; s != NULL; s = (https_port_list *) s->http.next) {
-            debugs(3, 1, "Initializing https_port " <<
-                   inet_ntoa(s->http.s.sin_addr) << ":" <<
-                   ntohs(s->http.s.sin_port) << " SSL context");
+            debugs(3, 1, "Initializing https_port " << s->http.s << " SSL context");
 
             s->sslContext = sslCreateServerContext(s->cert, s->key, s->version, s->cipher, s->options, s->sslflags, s->clientca, s->cafile, s->capath, s->crlfile, s->dhfile, s->sslcontext);
         }
@@ -2686,20 +2684,18 @@
     if (port == 0)
         self_destruct();
 
-/* FIXME INET6 : drop temp conversion */ IPAddress tmp;
-    tmp.SetPort(port);
+    s->s.SetPort(port);
 
     if (NULL == host)
-        tmp.SetAnyAddr();
-    else if ( tmp = host)
+        s->s.SetAnyAddr();
+    else if ( s->s = host)
         (void) 0;
     else if ((hp = gethostbyname(host))) {
         /* dont use ipcache */
-        tmp = *hp;
+        s->s = *hp;
         s->defaultsite = xstrdup(host);
     } else
         self_destruct();
-/* FIXME INET6 : drop temp conversion */ tmp.GetSockAddr(s->s);
 }
 
 static void
@@ -2808,10 +2804,11 @@
 static void
 dump_generic_http_port(StoreEntry * e, const char *n, const http_port_list * s)
 {
-    storeAppendPrintf(e, "%s %s:%d",
+    char buf[MAX_IPSTRLEN];
+
+    storeAppendPrintf(e, "%s %s",
                       n,
-                      inet_ntoa(s->s.sin_addr),
-                      ntohs(s->s.sin_port));
+                      s->s.ToURL(buf,MAX_IPSTRLEN));
 
     if (s->defaultsite)
         storeAppendPrintf(e, " defaultsite=%s", s->defaultsite);
Index: squid3/src/client_db.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/client_db.cc,v
retrieving revision 1.5.4.12
retrieving revision 1.5.4.13
diff -u -r1.5.4.12 -r1.5.4.13
--- squid3/src/client_db.cc	30 May 2007 05:06:07 -0000	1.5.4.12
+++ squid3/src/client_db.cc	3 Jun 2007 12:14:45 -0000	1.5.4.13
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_db.cc,v 1.5.4.12 2007/05/30 05:06:07 amosjeffries Exp $
+ * $Id: client_db.cc,v 1.5.4.13 2007/06/03 12:14:45 amosjeffries Exp $
  *
  * DEBUG: section 0     Client Database
  * AUTHOR: Duane Wessels
@@ -62,8 +62,7 @@
     char *buf = new char[MAX_IPSTRLEN];
     c = (ClientInfo *)memAllocate(MEM_CLIENT_INFO);
     c->hash.key = addr.NtoA(buf,MAX_IPSTRLEN);
-// FIXME INET6 : drop temp conversion should be:    c->addr = addr;
-    addr.GetInAddr(c->addr);
+    c->addr = addr;
     hash_join(client_table, &c->hash);
     statCounter.client_http.clients++;
 
@@ -249,8 +248,7 @@
 
     while ((c = (ClientInfo *) hash_next(client_table))) {
         storeAppendPrintf(sentry, "Address: %s\n", hashKeyStr(&c->hash));
-/* FIXME INET6 : drop temp conversion*/ IPAddress tmpipa(c->addr);
-        storeAppendPrintf(sentry, "Name: %s\n", fqdnFromAddr(tmpipa));
+        storeAppendPrintf(sentry, "Name: %s\n", fqdnFromAddr(c->addr));
         storeAppendPrintf(sentry, "Currently established connections: %d\n",
                           c->n_established);
         storeAppendPrintf(sentry, "    ICP Requests %d\n",
@@ -388,15 +386,15 @@
 
 #if SQUID_SNMP
 
-struct IN_ADDR *
-client_entry(struct IN_ADDR *current)
+IPAddress *
+client_entry(IPAddress *current)
 {
     ClientInfo *c = NULL;
-    char *key;
+    char key[MAX_IPSTRLEN];
 
     if (current)
     {
-        key = inet_ntoa(*current);
+        crrent->NtoA(key,MAX_IPSTRLEN);
         hash_first(client_table);
 
         while ((c = (ClientInfo *) hash_next(client_table))) {
Index: squid3/src/client_side.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/client_side.cc,v
retrieving revision 1.68.2.32
retrieving revision 1.68.2.33
diff -u -r1.68.2.32 -r1.68.2.33
--- squid3/src/client_side.cc	31 May 2007 12:14:50 -0000	1.68.2.32
+++ squid3/src/client_side.cc	3 Jun 2007 12:14:45 -0000	1.68.2.33
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.68.2.32 2007/05/31 12:14:50 amosjeffries Exp $
+ * $Id: client_side.cc,v 1.68.2.33 2007/06/03 12:14:45 amosjeffries Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -2085,10 +2085,9 @@
     debugs(33, 1, "Config 'request_header_max_size'= " << Config.maxRequestHeaderSize << " bytes.");
     clientReplyContext *repContext = dynamic_cast<clientReplyContext *>(node->data.getRaw());
     assert (repContext);
-/* FIXME INET6 : drop temp conversion */ IPAddress tmp(conn->peer);
     repContext->setReplyToError(ERR_TOO_BIG,
                                 HTTP_REQUEST_ENTITY_TOO_LARGE, METHOD_NONE, NULL,
-                                tmp, NULL, NULL, NULL);
+                                conn->peer, NULL, NULL, NULL);
     context->registerWithConn();
     context->pullData();
 }
@@ -2739,15 +2738,11 @@
 
     debugs(33, 4, "httpAccept: FD " << newfd << ": accepted");
     fd_note(newfd, "client http connect");
-/* FIXME INET6 : drop tem conversion */ IPAddress tmppeer(details->peer), tmpme(details->me);
-    connState = connStateCreate(tmppeer, tmpme, newfd, s);
+    connState = connStateCreate(details->peer, details->me, newfd, s);
     comm_add_close_handler(newfd, connStateFree, connState);
 
     if (Config.onoff.log_fqdn)
-{
-/* FIXME INET6 : drop temp conversion */ IPAddress tmp(details->peer);
-        fqdncache_gethostbyaddr(tmp, FQDN_LOOKUP_IF_MISS);
-}
+        fqdncache_gethostbyaddr(details->peer, FQDN_LOOKUP_IF_MISS);
 
     commSetTimeout(newfd, Config.Timeout.request, requestTimeout, connState);
 
@@ -2764,18 +2759,13 @@
     /* cbdataReferenceDone() happens in either fastCheck() or ~ACLCheckList */
 
     if (identChecklist.fastCheck())
-{
-/* FIXME INET6 : drop temp conversion */ IPAddress tmpme(details->me);
-/* FIXME INET6 : drop temp conversion */ IPAddress tmppeer(details->peer);
-        identStart(tmpme, tmppeer, clientIdentDone, connState);
-}
+        identStart(details->me, details->peer, clientIdentDone, connState);
 
 #endif
 
     connState->readSomeData();
 
-/* FIXME INET6 : drop temp conversion */ IPAddress tmp(details->peer);
-    clientdbEstablished(tmp, 1);
+    clientdbEstablished(details->peer, 1);
 
     incoming_sockets_accepted++;
 }
@@ -2993,10 +2983,9 @@
         }
 
         enter_suid();
-/* FIXME INET6 : drop temp conversion boundary */ IPAddress tmp(s->s);
         fd = comm_open(SOCK_STREAM,
                        IPPROTO_TCP,
-                       tmp,
+                       s->s,
                        COMM_NONBLOCKING, "HTTP Socket");
         leave_suid();
 
@@ -3010,7 +2999,7 @@
         debugs(1, 1, "Accepting " <<
                (s->transparent ? "transparently proxied" :
                        s->accel ? "accelerated" : "" ) 
-               << " HTTP connections at " << tmp 
+               << " HTTP connections at " << s->s
                << ", FD " << fd << "." );
 
         HttpSockets[NHttpSockets++] = fd;
@@ -3032,16 +3021,14 @@
         }
 
         if (s->sslContext == NULL) {
-            debugs(1, 1, "Can not accept HTTPS connections at " <<
-                   inet_ntoa(s->http.s.sin_addr) << ", port " <<
-                   (int) ntohs(s->http.s.sin_port));
+            debugs(1, 1, "Can not accept HTTPS connections at " << s->http.s);
         }
 
         enter_suid();
         fd = comm_open(SOCK_STREAM,
                        IPPROTO_TCP,
-                       s->http.s.sin_addr,
-                       ntohs(s->http.s.sin_port), COMM_NONBLOCKING, "HTTPS Socket");
+                       s->http.s,
+                       COMM_NONBLOCKING, "HTTPS Socket");
         leave_suid();
 
         if (fd < 0)
@@ -3051,9 +3038,7 @@
 
         comm_accept(fd, httpsAccept, s);
 
-        debugs(1, 1, "Accepting HTTPS connections at " <<
-               inet_ntoa(s->http.s.sin_addr) << ", port " <<
-               (int) ntohs(s->http.s.sin_port) << ", FD " << fd << ".");
+        debugs(1, 1, "Accepting HTTPS connections at " << s->http.s << ", FD " << fd << ".");
 
         HttpSockets[NHttpSockets++] = fd;
     }
Index: squid3/src/client_side_reply.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/client_side_reply.cc,v
retrieving revision 1.57.4.18
retrieving revision 1.57.4.19
diff -u -r1.57.4.18 -r1.57.4.19
--- squid3/src/client_side_reply.cc	30 May 2007 05:06:07 -0000	1.57.4.18
+++ squid3/src/client_side_reply.cc	3 Jun 2007 12:14:45 -0000	1.57.4.19
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side_reply.cc,v 1.57.4.18 2007/05/30 05:06:07 amosjeffries Exp $
+ * $Id: client_side_reply.cc,v 1.57.4.19 2007/06/03 12:14:45 amosjeffries Exp $
  *
  * DEBUG: section 88    Client-side Reply Routines
  * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
@@ -1731,7 +1731,6 @@
     buildMaxBodySize(reply);
 
     if (http->isReplyBodyTooLarge(reply->content_length)) {
-/* FIXME INET6 : check this getConn() usage is right after conversion */
         IPAddress tmp_noaddr; tmp_noaddr.SetNoAddr();
         ErrorState *err = clientBuildError(ERR_TOO_BIG, HTTP_FORBIDDEN, NULL,
                                            http->getConn() != NULL ? http->getConn()->peer : tmp_noaddr,
@@ -1777,7 +1776,6 @@
         if (page_id == ERR_NONE)
             page_id = ERR_ACCESS_DENIED;
 
-/* FIXME INET6 : check this getConn() usage is right after conversion. */
         IPAddress tmp_noaddr; tmp_noaddr.SetNoAddr();
         err = clientBuildError(page_id, HTTP_FORBIDDEN, NULL,
                              http->getConn() != NULL ? http->getConn()->peer : tmp_noaddr,
Index: squid3/src/client_side_request.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/client_side_request.cc,v
retrieving revision 1.33.4.19
retrieving revision 1.33.4.20
diff -u -r1.33.4.19 -r1.33.4.20
--- squid3/src/client_side_request.cc	3 Jun 2007 03:57:12 -0000	1.33.4.19
+++ squid3/src/client_side_request.cc	3 Jun 2007 12:14:46 -0000	1.33.4.20
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side_request.cc,v 1.33.4.19 2007/06/03 03:57:12 amosjeffries Exp $
+ * $Id: client_side_request.cc,v 1.33.4.20 2007/06/03 12:14:46 amosjeffries Exp $
  * 
  * DEBUG: section 85    Client-side Request Routines
  * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
@@ -460,7 +460,6 @@
         clientStreamNode *node = (clientStreamNode *)http->client_stream.tail->prev->data;
         clientReplyContext *repContext = dynamic_cast<clientReplyContext *>(node->data.getRaw());
         assert (repContext);
-/* FIXME INET6 : check getConn()->peer usage correct after conversion */
         IPAddress tmpnoaddr; tmpnoaddr.SetNoAddr();
         repContext->setReplyToError(page_id, status,
                                     http->request->method, NULL,
Index: squid3/src/comm.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/comm.cc,v
retrieving revision 1.47.2.33
retrieving revision 1.47.2.34
diff -u -r1.47.2.33 -r1.47.2.34
--- squid3/src/comm.cc	31 May 2007 10:51:06 -0000	1.47.2.33
+++ squid3/src/comm.cc	3 Jun 2007 12:14:46 -0000	1.47.2.34
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.47.2.33 2007/05/31 10:51:06 amosjeffries Exp $
+ * $Id: comm.cc,v 1.47.2.34 2007/06/03 12:14:46 amosjeffries Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -774,7 +774,7 @@
 comm_local_port(int fd)
 {
     IPAddress temp;
-    struct addrinfo addr;
+    struct addrinfo *addr = NULL;
     fde *F = &fd_table[fd];
 
     /* If the fd is closed already, just return */
@@ -791,26 +791,32 @@
     // (does assume its a TCP socket)
     temp.GetAddrInfo(addr);
 
-    if (getsockname(fd, (struct sockaddr *)addr.ai_addr, &addr.ai_addrlen)) {
+    if (getsockname(fd, (struct sockaddr *)addr->ai_addr, &(addr->ai_addrlen)) ) {
         debugs(50, 1, "comm_local_port: Failed to retrieve TCP/UDP port number for socket: FD " << fd << ": " << xstrerror());
+        temp.FreeAddrInfo(addr);
         return 0;
     }
-    temp = addr;
+    temp = *addr;
 
     F->local_addr.SetPort(temp.GetPort());
+
+    F->sock_family = addr->ai_family;
+
+    temp.FreeAddrInfo(addr);
+
     debugs(5, 6, "comm_local_port: FD " << fd << ": port " << F->local_addr.GetPort());
     return F->local_addr.GetPort();
 }
 
 static comm_err_t
-commBind(int s, struct addrinfo &in_addr)
+commBind(int s, struct addrinfo &inaddr)
 {
     statCounter.syscalls.sock.binds++;
 
-    if (bind(s, (struct sockaddr *) in_addr.ai_addr, in_addr.ai_addrlen) == 0)
+    if (bind(s, inaddr.ai_addr, inaddr.ai_addrlen) == 0)
         return COMM_OK;
 
-    debugs(50, 0, "commBind: Cannot bind socket FD " << s << " to " << IPAddress(in_addr) << ": " << xstrerror());
+    debugs(50, 0, "commBind: Cannot bind socket FD " << s << " to " << fd_table[s].local_addr << ": " << xstrerror());
 
     return COMM_ERROR;
 }
@@ -881,15 +887,15 @@
     statCounter.syscalls.sock.sockets++;
 
     /* Setup the socket addrinfo details for use */
-    struct addrinfo *AI = new addrinfo;
-    addr.GetAddrInfo(*AI); // MUST be first! sets AI to empty.
+    struct addrinfo *AI = NULL;
+    addr.GetAddrInfo(AI);
     AI->ai_socktype = sock_type;
     AI->ai_protocol = proto;
     AI->ai_flags = flags;
 
-    debugs(50, 3, "comm_openex: Attempt open socket to/on : " << addr);
+    debugs(50, 3, "comm_openex: Attempt open socket for: " << addr );
 
-    if ((new_socket = socket( AI->ai_family, AI->ai_socktype, AI->ai_protocol)) < 0)
+    if ((new_socket = socket(AI->ai_family, AI->ai_socktype, AI->ai_protocol)) < 0)
     {
         /* Increase the number of reserved fd's if calls to socket()
          * are failing because the open file table is full.  This
@@ -902,10 +908,14 @@
             debugs(50, 0, "comm_open: socket failure: " << xstrerror());
         }
 
+        addr.FreeAddrInfo(AI);
+
         PROF_stop(comm_open);
         return -1;
     }
 
+    debugs(50, 3, "comm_openex: Opened socket FD " << new_socket << " : family=" << AI->ai_family << ", type=" << AI->ai_socktype << ", protocol=" << AI->ai_protocol );
+
     /* set TOS if needed */
     if (TOS && comm_set_tos(new_socket, TOS) ) {
         tos = TOS;
@@ -937,6 +947,8 @@
 
     F->tos = TOS;
 
+    F->sock_family = AI->ai_family;
+
     if (!(flags & COMM_NOCLOEXEC))
         commSetCloseOnExec(new_socket);
 
@@ -960,13 +972,13 @@
     {
         if (commBind(new_socket, *AI) != COMM_OK) {
             comm_close(new_socket);
-            freeaddrinfo(AI);
+            addr.FreeAddrInfo(AI);
             return -1;
             PROF_stop(comm_open);
         }
     }
 
-    freeaddrinfo(AI);
+    addr.FreeAddrInfo(AI);
 
     if (flags & COMM_NONBLOCKING)
         if (commSetNonBlocking(new_socket) == COMM_ERROR)
@@ -1053,7 +1065,7 @@
 void
 ConnectStateData::callCallback(comm_err_t status, int xerrno)
 {
-    debugs(5, 3, "commConnectCallback: FD " << fd << ", data " << callback.data);
+    debugs(5, 3, "commConnectCallback: FD " << fd << ", data " << callback.data << ", status " << status);
 
     comm_remove_close_handler(fd, commConnectFree, this);
     CallBack<CNCB> aCallback = callback;
@@ -1100,12 +1112,20 @@
 int
 ConnectStateData::commResetFD()
 {
+    struct addrinfo *AI = NULL;
+    IPAddress nul;
+
     if (!cbdataReferenceValid(callback.data))
         return 0;
 
     statCounter.syscalls.sock.sockets++;
 
-    int fd2 = socket(AF_INET, SOCK_STREAM, 0);
+    /* setup a bare-bones addrinfo */
+    nul.GetAddrInfo(AI);
+
+    int fd2 = socket(AI->ai_family, AI->ai_socktype, AI->ai_protocol);
+
+    nul.FreeAddrInfo(AI);
 
     if (fd2 < 0) {
         debugs(5, 0, "commResetFD: socket: " << xstrerror());
@@ -1145,14 +1165,16 @@
 
     /* FIXME INET6 : seems this will ony work properly if those details mentioned above */
     /* are stored with the address. ie IPAddr = tuplet(addrinfo, sockkadr_in6) */
-    /* maybe use the NtoA of locl_addr to pull actual details needed for fd, the rebuild ?? */
-    struct addrinfo addr;
-    F->local_addr.GetAddrInfo(addr);
+    /* maybe use the NtoA of local_addr to pull actual details needed for fd, the rebuild ?? */
+    AI = NULL;
+    F->local_addr.GetAddrInfo(AI);
 
-    if (commBind(fd, addr) != COMM_OK) {
+    if (commBind(fd, *AI) != COMM_OK) {
         debugs(5, 0, "commResetFD: bind: " << xstrerror());
+        F->local_addr.FreeAddrInfo(AI);
         return 0;
     }
+    F->local_addr.FreeAddrInfo(AI);
 
     if (F->tos)
         comm_set_tos(fd, F->tos);
@@ -1227,11 +1249,13 @@
         break;
 
     case COMM_OK:
+        debugs(5, 5, "ConnectStateData::connect: FD " << fd << ": COMM_OK - connected");
         ipcacheMarkGoodAddr(host, S);
         callCallback(COMM_OK, 0);
         break;
 
     default:
+        debugs(5, 5, "ConnectStateData::connect: FD " << fd << ": * - try again");
         tries++;
         ipcacheMarkBadAddr(host, S);
 
@@ -1241,6 +1265,7 @@
         if (commRetryConnect()) {
             eventAdd("commReconnect", commReconnect, this, this->addrcount == 1 ? 0.05 : 0.0, 0);
         } else {
+            debugs(5, 5, "ConnectStateData::connect: FD " << fd << ": * - ERR tried too many times already.");
             callCallback(COMM_ERR_CONNECT, errno);
         }
     }
@@ -1280,13 +1305,15 @@
     int x;
     int err = 0;
     socklen_t errlen;
+    struct addrinfo *AI = NULL;
+    PROF_start(comm_connect_addr);
+
+    debugs(5, 9, "comm_connect_addr: connecting socket " << sock << " to " << address << " Old-State=" << fdc_table[sock].active);
 
-    struct addrinfo *AI = new addrinfo; // dynamic so freeaddrinfo(AI) can be properly used.
-    address.GetAddrInfo(*AI);
+    address.GetAddrInfo(AI, F->sock_family);
 
     assert(address.GetPort() != 0);
 
-    PROF_start(comm_connect_addr);
     /* Establish connection. */
     errno = 0;
 
@@ -1295,19 +1322,27 @@
         F->flags.called_connect = 1;
         statCounter.syscalls.sock.connects++;
 
-        x = connect(sock, (struct sockaddr *)AI->ai_addr, AI->ai_addrlen);
+        x = connect(sock, AI->ai_addr, AI->ai_addrlen);
 
         if (x < 0)
         {
-            debugs(5, 9, "connect FD " << sock << ": " << xstrerror());
-            debugs(14,9, "connected to: " << address );
+            debugs(5,5, "comm_connect_addr: sock=" << sock << ", addrinfo( " <<
+                         " flags=" << AI->ai_flags <<
+                         ", family=" << AI->ai_family <<
+                         ", socktype=" << AI->ai_socktype <<
+                         ", protocol=" << AI->ai_protocol <<
+                         ", &addr=" << AI->ai_addr <<
+                         ", addrlen=" << AI->ai_addrlen <<
+                         " )" );
+            debugs(5, 9, "connect FD " << sock << ": (" << x << ") " << xstrerror());
+            debugs(14,9, "connecting to: " << address );
         }
     } else
     {
 #if defined(_SQUID_NEWSOS6_)
         /* Makoto MATSUSHITA <matusita@ics.es.osaka-u.ac.jp> */
 
-        connect(sock, (struct sockaddr *)AI->ai_addr, AI->ai_addrlen);
+        connect(sock, AI->ai_addr, AI->ai_addrlen);
 
         if (errno == EINVAL) {
             errlen = sizeof(err);
@@ -1339,6 +1374,7 @@
 #endif
 
     }
+    address.FreeAddrInfo(AI);
 
     PROF_stop(comm_connect_addr);
 
@@ -1372,11 +1408,13 @@
     PROF_start(comm_accept);
     statCounter.syscalls.sock.accepts++;
     int sock;
-/* FIXME INET6 : drop temp conversion*/    IPAddress tmp(details.me);
-    struct addrinfo gai;
-    tmp.GetAddrInfo(gai); // TODO fill properly.
+    struct addrinfo *gai = NULL;
+    details.me.GetAddrInfo(gai);
+
+    if ((sock = accept(fd, (struct sockaddr *)gai->ai_addr, &gai->ai_addrlen)) < 0) {
+
+        details.me.FreeAddrInfo(gai);
 
-    if ((sock = accept(fd, (struct sockaddr *)gai.ai_addr, &gai.ai_addrlen)) < 0) {
         PROF_stop(comm_accept);
 
         if (ignoreErrno(errno))
@@ -1394,9 +1432,9 @@
         }
     }
 
-    tmp.SetEmpty();
+    details.me.SetEmpty();
 
-    getsockname(sock, (struct sockaddr *)gai.ai_addr, &gai.ai_addrlen);
+    getsockname(sock, (struct sockaddr *)gai->ai_addr, &gai->ai_addrlen);
     commSetCloseOnExec(sock);
     /* fdstat update */
     fd_open(sock, FD_SOCKET, "HTTP Request");
@@ -1404,11 +1442,15 @@
     fdd_table[sock].close_line = 0;
     fdc_table[sock].active = 1;
     fde *F = &fd_table[sock];
-/* FIXME INET6 : drop temp conversion */ IPAddress tmpb(details.peer);
-    tmpb.NtoA(F->ipaddr,MAX_IPSTRLEN);
-    F->remote_port = tmpb.GetPort();
-    F->local_addr.SetPort(tmp.GetPort());
+    details.peer.NtoA(F->ipaddr,MAX_IPSTRLEN);
+    F->remote_port = details.peer.GetPort();
+    F->local_addr.SetPort(details.me.GetPort());
+    F->sock_family = gai->ai_family;
+
     commSetNonBlocking(sock);
+
+    details.me.FreeAddrInfo(gai);
+
     PROF_stop(comm_accept);
     return sock;
 }
@@ -1647,19 +1689,19 @@
                 int len)
 {
     int x = 0;
-    struct addrinfo *AI = new addrinfo;
+    struct addrinfo *AI = NULL;
 
     PROF_start(comm_udp_sendto);
     statCounter.syscalls.sock.sendtos++;
 
-    to_addr.GetAddrInfo(*AI); // MUST be first! resets AI.
+    to_addr.GetAddrInfo(AI);
 
     debugs(50, 3, "comm_udp_sendto: Attempt to send UDP packet to " << to_addr <<
                   " using FD " << fd << " using Port " << comm_local_port(fd) );
 
-    x = sendto(fd, buf, len, 0, (struct sockaddr *)AI->ai_addr, AI->ai_addrlen);
+    x = sendto(fd, buf, len, 0, AI->ai_addr, AI->ai_addrlen);
 
-    freeaddrinfo(AI);
+    to_addr.FreeAddrInfo(AI);
 
     PROF_stop(comm_udp_sendto);
 
@@ -2525,9 +2567,7 @@
     cancelled = true;
 }
 
-ConnectionDetail::ConnectionDetail() {
-    memset(&me, 0, sizeof(me));
-    memset(&peer, 0, sizeof(peer));
+ConnectionDetail::ConnectionDetail() : me(), peer() {
 }
 
 bool
Index: squid3/src/fd.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/fd.cc,v
retrieving revision 1.10.4.3
retrieving revision 1.10.4.4
diff -u -r1.10.4.3 -r1.10.4.4
--- squid3/src/fd.cc	29 Apr 2007 03:01:37 -0000	1.10.4.3
+++ squid3/src/fd.cc	3 Jun 2007 12:14:47 -0000	1.10.4.4
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fd.cc,v 1.10.4.3 2007/04/29 03:01:37 amosjeffries Exp $
+ * $Id: fd.cc,v 1.10.4.4 2007/06/03 12:14:47 amosjeffries Exp $
  *
  * DEBUG: section 51    Filedescriptor Functions
  * AUTHOR: Duane Wessels
@@ -181,7 +181,7 @@
     }
 
     assert(!F->flags.open);
-    debugs(51, 3, "fd_open FD " << fd << " " << desc);
+    debugs(51, 3, "fd_open() FD " << fd << " " << desc);
     F->type = type;
     F->flags.open = 1;
     F->epoll_state = 0;
Index: squid3/src/fde.h
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/fde.h,v
retrieving revision 1.7.8.4
retrieving revision 1.7.8.5
diff -u -r1.7.8.4 -r1.7.8.5
--- squid3/src/fde.h	27 May 2007 12:52:47 -0000	1.7.8.4
+++ squid3/src/fde.h	3 Jun 2007 12:14:47 -0000	1.7.8.5
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fde.h,v 1.7.8.4 2007/05/27 12:52:47 amosjeffries Exp $
+ * $Id: fde.h,v 1.7.8.5 2007/06/03 12:14:47 amosjeffries Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -56,6 +56,7 @@
 
     IPAddress local_addr;
     unsigned char tos;
+    int sock_family;
     char ipaddr[MAX_IPSTRLEN];            /* dotted decimal address of peer */
     char desc[FD_DESC_SZ];
 
Index: squid3/src/forward.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/forward.cc,v
retrieving revision 1.35.4.24
retrieving revision 1.35.4.25
diff -u -r1.35.4.24 -r1.35.4.25
--- squid3/src/forward.cc	31 May 2007 11:37:43 -0000	1.35.4.24
+++ squid3/src/forward.cc	3 Jun 2007 12:14:47 -0000	1.35.4.25
@@ -1,6 +1,6 @@
 
 /*
- * $Id: forward.cc,v 1.35.4.24 2007/05/31 11:37:43 amosjeffries Exp $
+ * $Id: forward.cc,v 1.35.4.25 2007/06/03 12:14:47 amosjeffries Exp $
  *
  * DEBUG: section 17    Request Forwarding
  * AUTHOR: Duane Wessels
@@ -269,10 +269,8 @@
         FwdState::Pointer fwd = new FwdState(client_fd, entry, request);
 #if LINUX_TPROXY
         /* If we need to transparently proxy the request
-         * then we need the client source address and port */
-        fwd->src.sin_family = AF_INET;
-        fwd->src.sin_addr = request->client_addr;
-        fwd->src.sin_port = request->client_port;
+         * then we need the client source protocol, address and port */
+        fwd->src = request->client_addr;
 #endif
 
         fwd->start(fwd);
@@ -808,7 +806,7 @@
 
     tos = getOutgoingTOS(request);
 
-    debugs(17, 3, "fwdConnectStart: got addr " << outgoing << ", tos " << tos);
+    debugs(17, 3, "fwdConnectStart: got outgoing addr " << outgoing << ", tos " << tos);
 
     fd = comm_openex(SOCK_STREAM,
                      IPPROTO_TCP,
@@ -817,6 +815,8 @@
                      tos,
                      url);
 
+    debugs(17, 3, "fwdConnectStart: got TCP FD " << fd);
+
     if (fd < 0) {
         debugs(50, 4, "fwdConnectStart: " << xstrerror());
         ErrorState *anErr = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR, request);
Index: squid3/src/ftp.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/ftp.cc,v
retrieving revision 1.26.2.25
retrieving revision 1.26.2.26
diff -u -r1.26.2.25 -r1.26.2.26
--- squid3/src/ftp.cc	30 May 2007 05:43:46 -0000	1.26.2.25
+++ squid3/src/ftp.cc	3 Jun 2007 12:14:47 -0000	1.26.2.26
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.26.2.25 2007/05/30 05:43:46 amosjeffries Exp $
+ * $Id: ftp.cc,v 1.26.2.26 2007/06/03 12:14:47 amosjeffries Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -2640,6 +2640,7 @@
 ftpAcceptDataConnection(int fd, int newfd, ConnectionDetail *details,
                         comm_err_t flag, int xerrno, void *data)
 {
+    char ntoapeer[MAX_IPSTRLEN];
     FtpStateData *ftpState = (FtpStateData *)data;
     debugs(9, 3, "ftpAcceptDataConnection");
 
@@ -2652,12 +2653,11 @@
     }
 
     if (Config.Ftp.sanitycheck) {
-        char *ipaddr = (char *)inet_ntoa(details->peer.sin_addr);
+        details->peer.NtoA(ntoapeer,MAX_IPSTRLEN);
 
-        if (strcmp(fd_table[ftpState->ctrl.fd].ipaddr, ipaddr) != 0) {
+        if (strcmp(fd_table[ftpState->ctrl.fd].ipaddr, ntoapeer) != 0) {
             debugs(9, 1, "FTP data connection from unexpected server (" <<
-                   ipaddr << ":" << (int) ntohs(details->peer.sin_port) <<
-                   "), expecting " << fd_table[ftpState->ctrl.fd].ipaddr);
+                   details->peer << "), expecting " << fd_table[ftpState->ctrl.fd].ipaddr);
 
             comm_close(newfd);
             comm_accept(ftpState->data.fd, ftpAcceptDataConnection, ftpState);
@@ -2679,14 +2679,13 @@
 
     ftpState->data.fd = newfd;
 
-    ftpState->data.port = ntohs(details->peer.sin_port);
+    ftpState->data.port = details->peer.GetPort();
 
-    ftpState->data.host = xstrdup(inet_ntoa(details->peer.sin_addr));
+    details->peer.NtoA(ftpState->data.host,MAXHOSTNAMELEN);
 
     commSetTimeout(ftpState->ctrl.fd, -1, NULL, NULL);
 
-    commSetTimeout(ftpState->data.fd, Config.Timeout.read, FtpStateData::ftpTimeout,
-                   ftpState);
+    commSetTimeout(ftpState->data.fd, Config.Timeout.read, FtpStateData::ftpTimeout, ftpState);
 
     /* XXX We should have a flag to track connect state...
      *    host NULL -> not connected, port == local port
Index: squid3/src/icp_v2.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/icp_v2.cc,v
retrieving revision 1.17.8.17
retrieving revision 1.17.8.18
diff -u -r1.17.8.17 -r1.17.8.18
--- squid3/src/icp_v2.cc	31 May 2007 12:14:50 -0000	1.17.8.17
+++ squid3/src/icp_v2.cc	3 Jun 2007 12:14:48 -0000	1.17.8.18
@@ -1,6 +1,6 @@
 
 /*
- * $Id: icp_v2.cc,v 1.17.8.17 2007/05/31 12:14:50 amosjeffries Exp $
+ * $Id: icp_v2.cc,v 1.17.8.18 2007/06/03 12:14:48 amosjeffries Exp $
  *
  * DEBUG: section 12    Internet Cache Protocol (ICP)
  * AUTHOR: Duane Wessels
@@ -657,7 +657,7 @@
 
     IPAddress addr;
 
-    struct addrinfo *xai;
+    struct addrinfo *xai = NULL;
     int x;
     wordlist *s;
 
@@ -721,13 +721,10 @@
 
     theOutICPAddr.SetEmpty();
 
-    /* uses sockaddr_in6 as the largest structure possibly needed */
-    /* REALLY yuck all the dynamics I know, but going via addrinfo needs it */
-    /* and addrifno handles all the nasty magic mapping-unmapping of sockaddr's for us */
-    xai = new addrinfo;
-    xai->ai_addr = (struct sockaddr*)new sockaddr_in6; // largest bufer possibly needed.
-    xai->ai_addrlen = sizeof(struct sockaddr_in6);
-    memset(xai->ai_addr, '\0', xai->ai_addrlen);
+    /* IPv6 (via AF_INET6) allocates teh largest buffers possibly needed */
+    /* and addrinfo handles all the nasty magic mapping-unmapping of sockaddr's for us */
+    theOutICPAddr.GetAddrInfo(xai,AF_INET6);
+
     x = getsockname(theOutIcpConnection, xai->ai_addr, &xai->ai_addrlen);
 
     if (x < 0)
@@ -735,7 +732,7 @@
     else
         theOutICPAddr = *xai;
 
-    freeaddrinfo(xai);
+    theOutICPAddr.FreeAddrInfo(xai);
 }
 
 /*
Index: squid3/src/ipcache.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/ipcache.cc,v
retrieving revision 1.9.2.27
retrieving revision 1.9.2.28
diff -u -r1.9.2.27 -r1.9.2.28
--- squid3/src/ipcache.cc	30 May 2007 05:06:07 -0000	1.9.2.27
+++ squid3/src/ipcache.cc	3 Jun 2007 12:14:48 -0000	1.9.2.28
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ipcache.cc,v 1.9.2.27 2007/05/30 05:06:07 amosjeffries Exp $
+ * $Id: ipcache.cc,v 1.9.2.28 2007/06/03 12:14:48 amosjeffries Exp $
  *
  * DEBUG: section 14    IP Cache
  * AUTHOR: Harvest Derived
@@ -452,6 +452,7 @@
             i->addrs.in_addrs[j] = temp;
 
             debugs(14, 3, "ipcacheParse:  #" << j << " " << i->addrs.in_addrs[j]);
+            j++;
 
 #if USE_IPV6
         } else if (answers[k].type == RFC1035_TYPE_AAAA) {
@@ -463,6 +464,7 @@
             i->addrs.in_addrs[j] = temp;
 
             debugs(14, 3, "ipcacheParse:  #" << j << " " << i->addrs.in_addrs[j] );
+            j++;
 #endif
         } else if (answers[k].type != RFC1035_TYPE_CNAME) {
             debugs(14, 3, "ipcacheParse:  #x CNAME (dropped).");
@@ -474,7 +476,7 @@
 
     }
 
-    assert(j == na -1);
+    assert(j == na);
 
     if (na < 256)
         i->addrs.count = (unsigned char) na;
Index: squid3/src/neighbors.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/neighbors.cc,v
retrieving revision 1.23.4.20
retrieving revision 1.23.4.21
diff -u -r1.23.4.20 -r1.23.4.21
--- squid3/src/neighbors.cc	17 May 2007 10:51:15 -0000	1.23.4.20
+++ squid3/src/neighbors.cc	3 Jun 2007 12:14:48 -0000	1.23.4.21
@@ -1,6 +1,6 @@
 
 /*
- * $Id: neighbors.cc,v 1.23.4.20 2007/05/17 10:51:15 amosjeffries Exp $
+ * $Id: neighbors.cc,v 1.23.4.21 2007/06/03 12:14:48 amosjeffries Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -486,23 +486,21 @@
 void
 neighbors_init(void)
 {
-
-    struct sockaddr_in name;
-
-    socklen_t len = sizeof(struct sockaddr_in);
-
+    IPAddress nul;
+    struct addrinfo *AI = NULL;
     struct servent *sep = NULL;
     const char *me = getMyHostname();
     peer *thisPeer;
     peer *next;
     int fd = theInIcpConnection;
 
-    if (fd >= 0) {
+    /* setup addrinfo for use */
+    nul.GetAddrInfo(AI);
 
-        memset(&name, '\0', sizeof(struct sockaddr_in));
+    if (fd >= 0) {
 
-        if (getsockname(fd, (struct sockaddr *) &name, &len) < 0)
-            debugs(15, 1, "getsockname(" << fd << "," << &name << "," << &len << ") failed.");
+        if (getsockname(fd, AI->ai_addr, &AI->ai_addrlen) < 0)
+            debugs(15, 1, "getsockname(" << fd << "," << AI->ai_addr << "," << &AI->ai_addrlen << ") failed.");
 
         for (thisPeer = Config.peers; thisPeer; thisPeer = next) {
             http_port_list *s;
@@ -512,7 +510,7 @@
                 continue;
 
             for (s = Config.Sockaddr.http; s; s = s->next) {
-                if (thisPeer->http_port != ntohs(s->s.sin_port))
+                if (thisPeer->http_port != s->s.GetPort())
                     continue;
 
                 debugs(15, 1, "WARNING: Peer looks like this host");
@@ -522,7 +520,6 @@
                        "/" << thisPeer->http_port << "/" <<
                        thisPeer->icp.port);
 
-
                 neighborRemove(thisPeer);
             }
         }
@@ -537,12 +534,14 @@
         echo_hdr.reqnum = 0;
         echo_hdr.flags = 0;
         echo_hdr.pad = 0;
-        echo_hdr.shostid = name.sin_addr.s_addr;
+        nul = *AI;
+        nul.GetInAddr( *((struct in_addr*)&echo_hdr.shostid) );
         sep = getservbyname("echo", "udp");
         echo_port = sep ? ntohs((u_short) sep->s_port) : 7;
     }
 
     first_ping = Config.peers;
+    nul.FreeAddrInfo(AI);
 }
 
 void
@@ -1193,25 +1192,36 @@
 int
 neighborUp(const peer * p)
 {
+    debugs(15, 3, "neighborUp: Testing UP/DOWN status of " << p->host << " (" << p->in_addr << ") ");
     if (!p->tcp_up) {
-        if (!peerProbeConnect((peer *) p))
+        debugs(15, 3, "neighborUp: DOWN (probing): " << p->host << " (" << p->in_addr << ")");
+        if (!peerProbeConnect((peer *) p)) {
+            debugs(15, 3, "neighborUp: DOWN (probed): " << p->host << " (" << p->in_addr << ")");
             return 0;
+        }
     }
 
     /*
      * The peer can not be UP if we don't have any IP addresses
      * for it. 
      */
-    if (0 == p->n_addresses)
+    if (0 == p->n_addresses) {
+        debugs(15, 3, "neighborUp: DOWN (no-ip): " << p->host << " (" << p->in_addr << ")");
         return 0;
+    }
 
-    if (p->options.no_query)
+    if (p->options.no_query) {
+        debugs(15, 3, "neighborUp: UP (no-query): " << p->host << " (" << p->in_addr << ")");
         return 1;
+    }
 
     if (p->stats.probe_start != 0 &&
-            squid_curtime - p->stats.probe_start > Config.Timeout.deadPeer)
+            squid_curtime - p->stats.probe_start > Config.Timeout.deadPeer) {
+        debugs(15, 3, "neighborUp: DOWN (dead): " << p->host << " (" << p->in_addr << ")");
         return 0;
+    }
 
+    debugs(15, 3, "neighborUp: UP: " << p->host << " (" << p->in_addr << ")");
     return 1;
 }
 
Index: squid3/src/peer_digest.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/peer_digest.cc,v
retrieving revision 1.11.4.10
retrieving revision 1.11.4.11
diff -u -r1.11.4.10 -r1.11.4.11
--- squid3/src/peer_digest.cc	30 May 2007 05:06:09 -0000	1.11.4.10
+++ squid3/src/peer_digest.cc	3 Jun 2007 12:14:48 -0000	1.11.4.11
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_digest.cc,v 1.11.4.10 2007/05/30 05:06:09 amosjeffries Exp $
+ * $Id: peer_digest.cc,v 1.11.4.11 2007/06/03 12:14:48 amosjeffries Exp $
  *
  * DEBUG: section 72    Peer Digest Routines
  * AUTHOR: Alex Rousskov
@@ -268,8 +268,7 @@
         return;
     }
 
-/* FIXME INET6 : drop temp conversion */ IPAddress tmp(pd->peer->host); tmp.SetPort(pd->peer->http_port);
-    debugs(72, 3, "peerDigestCheck: peer " << tmp );
+    debugs(72, 3, "peerDigestCheck: peer " <<  pd->peer->host << ":" << pd->peer->http_port);
     debugs(72, 3, "peerDigestCheck: time: " << squid_curtime << 
            ", last received: " << (long int) pd->times.received << "  (" << 
            std::showpos << (int) (squid_curtime - pd->times.received) << ")");
Index: squid3/src/peer_select.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/peer_select.cc,v
retrieving revision 1.9.4.11
retrieving revision 1.9.4.12
diff -u -r1.9.4.11 -r1.9.4.12
--- squid3/src/peer_select.cc	16 May 2007 16:04:58 -0000	1.9.4.11
+++ squid3/src/peer_select.cc	3 Jun 2007 12:14:48 -0000	1.9.4.12
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_select.cc,v 1.9.4.11 2007/05/16 16:04:58 amosjeffries Exp $
+ * $Id: peer_select.cc,v 1.9.4.12 2007/06/03 12:14:48 amosjeffries Exp $
  *
  * DEBUG: section 44    Peer Selection Algorithm
  * AUTHOR: Duane Wessels
@@ -180,9 +180,7 @@
 #endif
 
     if (psstate->entry)
-        psstate->entry->lock()
-
-        ;
+        psstate->entry->lock();
 
     peerSelectFoo(psstate);
 }
@@ -272,8 +270,7 @@
     if (myhops && myhops <= Config.minDirectHops)
         return 1;
 
-/* FIXME INET6 : drop temp conversion */ IPAddress tmp(psstate->closest_parent_miss);
-    p = whichPeer(tmp);
+    p = whichPeer(psstate->closest_parent_miss);
 
     if (p == NULL)
         return 0;
@@ -467,13 +464,11 @@
             code = SOURCE_FASTEST;
         } else
 #endif
-            if (ps->closest_parent_miss.sin_addr.s_addr != any_addr.s_addr) {
-/* FIXME INET6 : drop temp conversion */ IPAddress tmp(ps->closest_parent_miss);
-                p = whichPeer(tmp);
+            if (!ps->closest_parent_miss.IsAnyAddr()) {
+                p = whichPeer(ps->closest_parent_miss);
                 code = CLOSEST_PARENT_MISS;
-            } else if (ps->first_parent_miss.sin_addr.s_addr != any_addr.s_addr) {
-/* FIXME INET6 : drop temp conversion */ IPAddress tmp(ps->first_parent_miss);
-                p = whichPeer(tmp);
+            } else if (!ps->first_parent_miss.IsAnyAddr()) {
+                p = whichPeer(ps->first_parent_miss);
                 code = FIRST_PARENT_MISS;
             }
     if (p && code != HIER_NONE) {
@@ -616,8 +611,7 @@
                 netdbUpdatePeer(ps->request, p, rtt, hops);
 
             if (rtt && (ps->ping.p_rtt == 0 || rtt < ps->ping.p_rtt)) {
-// FIXME INET6: drop temp conversion: should be:                ps->closest_parent_miss = p->in_addr;
-                p->in_addr.GetSockAddr(ps->closest_parent_miss);
+                ps->closest_parent_miss = p->in_addr;
                 ps->ping.p_rtt = rtt;
             }
         }
@@ -628,7 +622,7 @@
         return;
 
     /* set FIRST_MISS if there is no CLOSEST parent */
-    if (ps->closest_parent_miss.sin_addr.s_addr != any_addr.s_addr)
+    if (!ps->closest_parent_miss.IsAnyAddr())
         return;
 
     rtt = (tvSubMsec(ps->ping.start, current_time) - p->basetime) / p->weight;
@@ -636,10 +630,8 @@
     if (rtt < 1)
         rtt = 1;
 
-    if (ps->first_parent_miss.sin_addr.s_addr == any_addr.s_addr ||
-            rtt < ps->ping.w_rtt) {
-// FIXME INET6: drop temp conversion: should be:        ps->first_parent_miss = p->in_addr;
-        p->in_addr.GetSockAddr(ps->first_parent_miss);
+    if (ps->first_parent_miss.IsAnyAddr() || rtt < ps->ping.w_rtt) {
+        ps->first_parent_miss = p->in_addr;
         ps->ping.w_rtt = rtt;
     }
 }
@@ -724,8 +716,7 @@
             netdbUpdatePeer(ps->request, p, rtt, hops);
 
             if (rtt && (ps->ping.p_rtt == 0 || rtt < ps->ping.p_rtt)) {
-// FIXME INET6: drop temp conversion: should be:                ps->closest_parent_miss = p->in_addr;
-                p->in_addr.GetSockAddr(ps->closest_parent_miss);
+                ps->closest_parent_miss = p->in_addr;
                 ps->ping.p_rtt = rtt;
             }
         }
@@ -736,7 +727,7 @@
         return;
 
     /* set FIRST_MISS if there is no CLOSEST parent */
-    if (ps->closest_parent_miss.sin_addr.s_addr != any_addr.s_addr)
+    if (!ps->closest_parent_miss.IsAnyAddr())
         return;
 
     rtt = (tvSubMsec(ps->ping.start, current_time) - p->basetime) / p->weight;
@@ -744,10 +735,8 @@
     if (rtt < 1)
         rtt = 1;
 
-    if (ps->first_parent_miss.sin_addr.s_addr == any_addr.s_addr ||
-            rtt < ps->ping.w_rtt) {
-// FIXME INET6: drop temp conversion: should be:                ps->first_parent_miss = p->in_addr;
-                p->in_addr.GetSockAddr(ps->first_parent_miss);
+    if (ps->first_parent_miss.IsAnyAddr() || rtt < ps->ping.w_rtt) {
+        ps->first_parent_miss = p->in_addr;
         ps->ping.w_rtt = rtt;
     }
 }
Index: squid3/src/protos.h
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/protos.h,v
retrieving revision 1.48.4.24
retrieving revision 1.48.4.25
diff -u -r1.48.4.24 -r1.48.4.25
--- squid3/src/protos.h	31 May 2007 11:37:43 -0000	1.48.4.24
+++ squid3/src/protos.h	3 Jun 2007 12:14:48 -0000	1.48.4.25
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.48.4.24 2007/05/31 11:37:43 amosjeffries Exp $
+ * $Id: protos.h,v 1.48.4.25 2007/06/03 12:14:48 amosjeffries Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -267,7 +267,7 @@
 SQUIDCEXTERN void icmpOpen(void);
 SQUIDCEXTERN void icmpClose(void);
 
-SQUIDCEXTERN void icmpSourcePing(struct IN_ADDR to, const icp_common_t *, const char *url);
+SQUIDCEXTERN void icmpSourcePing(IPAddress &to, const icp_common_t *, const char *url);
 
 SQUIDCEXTERN void icmpDomainPing(IPAddress &to, const char *domain);
 
@@ -283,7 +283,7 @@
 
 SQUIDCEXTERN struct IN_ADDR *oid2addr(oid * id);
 
-SQUIDCEXTERN struct IN_ADDR *client_entry(struct IN_ADDR *current);
+SQUIDCEXTERN IPAddress *client_entry(IPAddress *current);
 SQUIDCEXTERN variable_list *snmp_basicFn(variable_list *, snint *);
 SQUIDCEXTERN variable_list *snmp_confFn(variable_list *, snint *);
 SQUIDCEXTERN variable_list *snmp_sysFn(variable_list *, snint *);
Index: squid3/src/structs.h
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/structs.h,v
retrieving revision 1.66.2.21
retrieving revision 1.66.2.22
diff -u -r1.66.2.21 -r1.66.2.22
--- squid3/src/structs.h	30 May 2007 05:06:09 -0000	1.66.2.21
+++ squid3/src/structs.h	3 Jun 2007 12:14:48 -0000	1.66.2.22
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.66.2.21 2007/05/30 05:06:09 amosjeffries Exp $
+ * $Id: structs.h,v 1.66.2.22 2007/06/03 12:14:48 amosjeffries Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -133,7 +133,7 @@
 {
     http_port_list *next;
 
-    struct sockaddr_in s;
+    IPAddress s;
     char *protocol;            /* protocol name */
     char *name;                /* visible name */
     char *defaultsite;         /* default web site */
@@ -1195,6 +1195,7 @@
 
 #if USE_ICMP
 
+/* This is a line-data format struct. DO NOT alter. */
 struct _pingerEchoData
 {
 
@@ -1204,6 +1205,7 @@
     char payload[PINGER_PAYLOAD_SZ];
 };
 
+/* This is a line-data format struct. DO NOT alter. */
 struct _pingerReplyData
 {
 
@@ -1610,7 +1612,7 @@
 {
     hash_link hash;		/* must be first */
 
-    struct IN_ADDR addr;
+    IPAddress addr;
 
     struct
     {
Index: squid3/src/tools.cc
===================================================================
RCS file: /cvsroot/squid-sf//squid3/src/tools.cc,v
retrieving revision 1.22.2.18
retrieving revision 1.22.2.19
diff -u -r1.22.2.18 -r1.22.2.19
--- squid3/src/tools.cc	28 May 2007 14:31:46 -0000	1.22.2.18
+++ squid3/src/tools.cc	3 Jun 2007 12:14:48 -0000	1.22.2.19
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.22.2.18 2007/05/28 14:31:46 amosjeffries Exp $
+ * $Id: tools.cc,v 1.22.2.19 2007/06/03 12:14:48 amosjeffries Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -1260,12 +1260,12 @@
 getMyPort(void)
 {
     if (Config.Sockaddr.http)
-        return ntohs(Config.Sockaddr.http->s.sin_port);
+        return Config.Sockaddr.http->s.GetPort();
 
 #if USE_SSL
 
     if (Config.Sockaddr.https)
-        return ntohs(Config.Sockaddr.https->http.s.sin_port);
+        return Config.Sockaddr.https->http.s.GetPort();
 
 #endif
 
