]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 2571: pt 1: Add DNS failover to use IPv4-only listen when IPv6 fails.
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 24 Jan 2009 00:18:51 +0000 (13:18 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 24 Jan 2009 00:18:51 +0000 (13:18 +1300)
TODO: there are other ports to check for this same behavior.

src/dns_internal.cc

index cae1e5389ff0637cefc03699d3e4f89bc8403cbe..e2dd0cf9dddf838a0f85777bb367cd46c076ba7c 100644 (file)
@@ -1354,6 +1354,19 @@ idnsInit(void)
 
         debugs(78, 2, "idnsInit: attempt open DNS socket to: " << addr);
 
+#if USE_IPV6
+        if ( DnsSocket < 0 && addr.IsIPv6() && addr.SetIPv4() ) {
+            /* attempt to open this IPv4-only. */
+            DnsSocket = comm_open(SOCK_DGRAM,
+                                  IPPROTO_UDP,
+                                  addr,
+                                  COMM_NONBLOCKING,
+                                  "DNS Socket");
+
+            debugs(78, 2, "idnsInit: attempt open DNS socket to: " << addr);
+        }
+#endif
+
         if (DnsSocket < 0)
             fatal("Could not create a DNS socket");