--------------------- PatchSet 4914 Date: 2007/06/29 16:29:35 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Attempted fix: Squid connecting to any program on localhost uses ::1 Generic failover to trying IPv4-only link if an IPv6 one fails and the IPA is an ambiguous one which can be IPv4 also. Members: src/comm.cc:1.47.2.37->1.47.2.38 Index: squid3/src/comm.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/comm.cc,v retrieving revision 1.47.2.37 retrieving revision 1.47.2.38 diff -u -r1.47.2.37 -r1.47.2.38 --- squid3/src/comm.cc 10 Jun 2007 08:55:31 -0000 1.47.2.37 +++ squid3/src/comm.cc 29 Jun 2007 16:29:35 -0000 1.47.2.38 @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.47.2.37 2007/06/10 08:55:31 amosjeffries Exp $ + * $Id: comm.cc,v 1.47.2.38 2007/06/29 16:29:35 amosjeffries Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -1382,6 +1382,22 @@ else if (ignoreErrno(errno)) status = COMM_INPROGRESS; else +#if USE_IPV6 + if( S.IsIPv4() && F->sock_family == AF_INET6 ) { + + /* failover to trying IPv4-only link if an IPv6 one fails */ + /* to catch the edge case of apps listening on IPv4-localhost */ + F->sock_family = AF_INET; + int res = comm_connect_addr(sock, address); + + /* if that fails too, undo our temporary socktype hack so the repeat works properly. */ + if(res == COMM_ERROR) + F->sock_family = AF_INET6; + + return res; + } + else +#endif return COMM_ERROR; address.NtoA(F->ipaddr, MAX_IPSTRLEN);