From: Amos Jeffries Date: Tue, 22 Jan 2013 11:10:02 +0000 (-0700) Subject: Bug 3735: raw-IPv6 domain URLs crash if IPv6-disabled X-Git-Tag: SQUID_3_3_1~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f89aa4c4fb3f0a4a1fe61e3269bdd4387954b54;p=thirdparty%2Fsquid.git Bug 3735: raw-IPv6 domain URLs crash if IPv6-disabled --- diff --git a/src/peer_select.cc b/src/peer_select.cc index b707a07ff9..c5eadc030d 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -46,6 +46,7 @@ #include "icmp/net_db.h" #include "ICP.h" #include "ipcache.h" +#include "ip/tools.h" #include "Mem.h" #include "neighbors.h" #include "peer_sourcehash.h" @@ -348,6 +349,14 @@ peerSelectDnsResults(const ipcache_addrs *ia, const DnsLookupDetails &details, v p = new Comm::Connection(); p->remote = ia->in_addrs[n]; + + // when IPv6 is disabled we cannot use it + if (!Ip::EnableIpv6 && p->remote.IsIPv6()) { + const char *host = (fs->_peer ? fs->_peer->host : psstate->request->GetHost()); + ipcacheMarkBadAddr(host, p->remote); + continue; + } + if (fs->_peer) p->remote.SetPort(fs->_peer->http_port); else