From: Amos Jeffries Date: Mon, 28 Jan 2013 11:48:06 +0000 (-0700) Subject: Bug 3735: raw-IPv6 domain URLs crash if IPv6-disabled X-Git-Tag: SQUID_3_2_7~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecc28375dd176ec10122ffd6fc8d110f131f76c4;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 7b8cb75583..d412f61d2c 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -47,6 +47,7 @@ #include "SquidTime.h" #include "icmp/net_db.h" #include "ipcache.h" +#include "ip/tools.h" static struct { int timeouts; @@ -352,6 +353,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