From 73c480de0cee47cb39b72df4b9bd3cebfec79e46 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sun, 12 Oct 2008 02:45:20 +1300 Subject: [PATCH] Author: Henrik Nordstrom Bug 2447: pt 1: Segfault on failed TCP DNS query Adds debug messages for better tracking. Aborts fatal operations early. --- src/dns_internal.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/dns_internal.cc b/src/dns_internal.cc index 32d951d459..dab4b94c1f 100755 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -715,6 +715,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; } @@ -739,6 +740,7 @@ idnsInitVC(int ns) { nsvc *vc = cbdataAlloc(nsvc); nameservers[ns].vc = vc; + vc->ns = ns; struct IN_ADDR addr; @@ -776,6 +778,11 @@ 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[ns].S.sin_addr) << "!"); + return; + } + vc->queue->reset(); short head = htons(q->sz); -- 2.47.2