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

index 7b8cb75583a15d0ca5f034e80cf4f523fc79141d..d412f61d2c5777b3836008d8246a3c969476adab 100644 (file)
@@ -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