From ecc28375dd176ec10122ffd6fc8d110f131f76c4 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 28 Jan 2013 04:48:06 -0700 Subject: [PATCH] Bug 3735: raw-IPv6 domain URLs crash if IPv6-disabled --- src/peer_select.cc | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- 2.47.2