From: Aram Sargsyan Date: Tue, 21 Jun 2022 11:54:50 +0000 (+0000) Subject: dig +nssearch: send more queries even if sending the previous one fails X-Git-Tag: v9.19.4~12^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=98da5129a5b19f1d07c245fe9f85fedc36788aaf;p=thirdparty%2Fbind9.git dig +nssearch: send more queries even if sending the previous one fails 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. --- diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index ad773d1df56..dc88010b592 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -2663,7 +2663,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)); @@ -2694,39 +2693,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; }