]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Henrik Nordstrom <hno@squid-cache.org>
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 11 Oct 2008 13:45:20 +0000 (02:45 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 11 Oct 2008 13:45:20 +0000 (02:45 +1300)
Bug 2447: pt 1: Segfault on failed TCP DNS query

Adds debug messages for better tracking.
Aborts fatal operations early.

src/dns_internal.cc

index 32d951d4598f5d487d6e30408ca2c927240df545..dab4b94c1fcb81243e9942ca734084c73b8a8687 100755 (executable)
@@ -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);