]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3735: raw-IPv6 domain URLs crash if IPv6-disabled
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 22 Jan 2013 11:10:02 +0000 (04:10 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 22 Jan 2013 11:10:02 +0000 (04:10 -0700)
src/peer_select.cc

index b707a07ff97daf34cd49589eda7f0d97f2477201..c5eadc030d3d9e371802823b7b83ea9ad1ab219c 100644 (file)
@@ -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