From: Amos Jeffries Date: Sat, 24 Jan 2009 00:18:51 +0000 (+1300) Subject: Bug 2571: pt 1: Add DNS failover to use IPv4-only listen when IPv6 fails. X-Git-Tag: SQUID_3_2_0_1~1246 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8ee81e6ff109871fc9593952585511bd1a1fd8df;p=thirdparty%2Fsquid.git Bug 2571: pt 1: Add DNS failover to use IPv4-only listen when IPv6 fails. TODO: there are other ports to check for this same behavior. --- diff --git a/src/dns_internal.cc b/src/dns_internal.cc index cae1e5389f..e2dd0cf9dd 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -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");