]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2923. [bug] 'dig +trace' could drop core after "connection
authorMark Andrews <marka@isc.org>
Thu, 24 Jun 2010 07:32:27 +0000 (07:32 +0000)
committerMark Andrews <marka@isc.org>
Thu, 24 Jun 2010 07:32:27 +0000 (07:32 +0000)
                        timeout". [RT #21514]

CHANGES
bin/dig/dighost.c

diff --git a/CHANGES b/CHANGES
index 1bf9909c999625d78a5d3483a4032425595fb91b..2ad15e51f95f083e4414f1058a84dbccac3523d1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+2923.  [bug]           'dig +trace' could drop core after "connection
+                       timeout". [RT #21514]
+
 2921.  [bug]           The resolver could attempt to destroy a fetch context
                        too soon.  [RT #19878]
 
index 38145ee5261e4bda02e4ca3b80cfb871c92c81de..9230b4f62c6c0fff5615b5070beaf5de81d120c6 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: dighost.c,v 1.304.12.20 2010/05/18 02:29:39 tbox Exp $ */
+/* $Id: dighost.c,v 1.304.12.21 2010/06/24 07:32:27 marka Exp $ */
 
 /*! \file
  *  \note
@@ -2218,6 +2218,15 @@ force_timeout(dig_lookup_t *l, dig_query_t *query) {
                      isc_result_totext(ISC_R_NOMEMORY));
        }
        isc_task_send(global_task, &event);
+
+       /*
+        * The timer may have expired if, for example, get_address() takes
+        * long time and the timer was running on a different thread.
+        * We need to cancel the possible timeout event not to confuse
+        * ourselves due to the duplicate events.
+        */
+       if (l->timer != NULL)
+               isc_timer_detach(&l->timer);
 }
 
 
@@ -2241,7 +2250,7 @@ send_tcp_connect(dig_query_t *query) {
        query->waiting_connect = ISC_TRUE;
        query->lookup->current_query = query;
        result = get_address(query->servname, port, &query->sockaddr);
-       if (result == ISC_R_NOTFOUND) {
+       if (result != ISC_R_SUCCESS) {
                /*
                 * This servname doesn't have an address.  Try the next server
                 * by triggering an immediate 'timeout' (we lie, but the effect
@@ -2323,7 +2332,7 @@ send_udp(dig_query_t *query) {
                /* XXX Check the sense of this, need assertion? */
                query->waiting_connect = ISC_FALSE;
                result = get_address(query->servname, port, &query->sockaddr);
-               if (result == ISC_R_NOTFOUND) {
+               if (result != ISC_R_SUCCESS) {
                        /* This servname doesn't have an address. */
                        force_timeout(l, query);
                        return;