]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3732: Fix ConnOpener IPv6 awareness
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 28 Jan 2013 11:45:07 +0000 (04:45 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 28 Jan 2013 11:45:07 +0000 (04:45 -0700)
When updating IPv6 support for split-stack one USE_IPV6 wrapper was
omitted conversion to the EnabledIpv6 stack auto-detect mechanism.
This resulted in IPv6 addresses being mis-converted on split-stack
systems or with IPv6 disabled in the kernel and --enable-ipv6 built.

The visible symptom is "assert(FALSE)" in Ip::Address::GetAddrInfo().

src/comm/ConnOpener.cc

index cb53b19f68f06f34854bcafe24bd3d9afdb4f71e..0b763c981dad99ccf653adbec180327db2d18adc 100644 (file)
@@ -10,6 +10,7 @@
 #include "fde.h"
 #include "icmp/net_db.h"
 #include "ipcache.h"
+#include "ip/tools.h"
 #include "SquidTime.h"
 
 CBDATA_NAMESPACED_CLASS_INIT(Comm, ConnOpener);
@@ -155,12 +156,10 @@ Comm::ConnOpener::start()
 
     /* get a socket open ready for connecting with */
     if (temporaryFd_ < 0) {
-#if USE_IPV6
         /* outbound sockets have no need to be protocol agnostic. */
-        if (conn_->remote.IsIPv4()) {
+        if (!(Ip::EnableIpv6&IPV6_SPECIAL_V4MAPPING) && conn_->remote.IsIPv4()) {
             conn_->local.SetIPv4();
         }
-#endif
         temporaryFd_ = comm_openex(SOCK_STREAM, IPPROTO_TCP, conn_->local, conn_->flags, conn_->tos, conn_->nfmark, host_);
         if (temporaryFd_ < 0) {
             doneConnecting(COMM_ERR_CONNECT, 0);