From: Henrik Nordstrom Date: Wed, 1 Oct 2008 20:25:41 +0000 (+0200) Subject: Bug #2447: Segfault on failed TCP DNS query X-Git-Tag: SQUID_3_1_0_1~45^2~8 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=aba53d4c40280d368ea8efd4f5e80a03b2e5ac72;p=thirdparty%2Fsquid.git Bug #2447: Segfault on failed TCP DNS query This patch makes Squid log the DNS failure if it fails to connect to a DNS server over TCP. TCP is required if the DNS response do not fit within the small DNS UDP packet size (ca 0.5kb). This patch apparently do not solve the segmentation fault, but at least logs the condition properly. --- diff --git a/src/dns_internal.cc b/src/dns_internal.cc index f3b8d2403b..a32b35030c 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -718,6 +718,7 @@ idnsInitVCConnected(int fd, comm_err_t status, int xerrno, void *data) nsvc * vc = (nsvc *)data; if (status != COMM_OK) { + debugs(78, 1, "idnsInitVCConnected: Failed to connect to nameserver " << inet_ntoa(nameservers[vc->ns].S.sin_addr) << " using TCP!"); comm_close(fd); return; } @@ -744,6 +745,7 @@ idnsInitVC(int ns) nsvc *vc = cbdataAlloc(nsvc); nameservers[ns].vc = vc; + vc->ns = ns; IPAddress addr; @@ -780,6 +782,12 @@ idnsSendQueryVC(idns_query * q, int ns) nsvc *vc = nameservers[ns].vc; + if (!vc) { + debugs(78, 1, "idnsSendQuery: Failed to initiate TCP connection to nameserver " << inet_ntoa(nameservers[vc->ns].S.sin_addr) << "!"); + + return; + } + vc->queue->reset(); short head = htons(q->sz);