]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
dig +nssearch: send more queries even if sending the previous one fails
authorAram Sargsyan <aram@isc.org>
Tue, 21 Jun 2022 11:54:50 +0000 (11:54 +0000)
committerAram Sargsyan <aram@isc.org>
Fri, 22 Jul 2022 09:41:41 +0000 (09:41 +0000)
In the NSSEARCH followup lookup, when one of the queries fails to be
sent, DiG doesn't start the next query. This is a mistake, because in
NSSEARCH mode the queries are independent and DiG shouldn't stop the
lookup process just because sending a query to one of the name servers
returns an error code.

Restructure the `send_done()` function to unconditionally send the next
query in NSSEARCH mode, if it exists.

(cherry picked from commit 49ac879dfad91ac08201be3e351450fd9d83b9f5)

bin/dig/dighost.c

index b1b2b605e6109104ab15b452a5c06bca11ca701d..6a3eec31f0c9bbb6d56036d27ab3f3b88453cef1 100644 (file)
@@ -2673,7 +2673,6 @@ setup_lookup(dig_lookup_t *lookup) {
 static void
 send_done(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
        dig_query_t *query = (dig_query_t *)arg;
-       dig_query_t *next = NULL;
        dig_lookup_t *l = NULL;
 
        REQUIRE(DIG_VALID_QUERY(query));
@@ -2704,39 +2703,31 @@ send_done(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) {
                return;
        } else if (eresult != ISC_R_SUCCESS) {
                debug("send failed: %s", isc_result_totext(eresult));
-               query_detach(&query);
-               lookup_detach(&l);
-               UNLOCK_LOOKUP;
-               return;
        }
 
        if (l->ns_search_only && !l->trace_root) {
+               dig_query_t *next = ISC_LIST_NEXT(query, link);
                bool tcp_mode = l->tcp_mode;
 
-               debug("sending next, since searching");
-               next = ISC_LIST_NEXT(query, link);
-
                query_detach(&query);
                lookup_detach(&l);
 
                if (next == NULL) {
                        clear_current_lookup();
                } else {
+                       debug("sending next, since searching");
+
                        if (tcp_mode) {
                                start_tcp(next);
                        } else {
                                start_udp(next);
                        }
                }
-
-               check_if_done();
-               UNLOCK_LOOKUP;
-               return;
+       } else {
+               query_detach(&query);
+               lookup_detach(&l);
        }
 
-       query_detach(&query);
-       lookup_detach(&l);
-
        check_if_done();
        UNLOCK_LOOKUP;
 }