From 086f569f5270fc412771429ea19e384a9ad13a46 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Tue, 9 Jan 2024 11:51:34 +0000 Subject: [PATCH] Print a dig comment about the failed query consistently Dig failed to print a comment about the reason of the unacceptable query reply got from a server when there was no other query to start in the lookup's chain. Add an "else" block to print out the comment even when not starting up the next query. (cherry picked from commit 913b20abf816b1a2d8581fab7f780f5addf3b5e0) --- bin/dig/dighost.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 5b4dca2774..5d40c6155f 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -4361,29 +4361,32 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region, if ((msg->rcode == dns_rcode_servfail && !l->servfail_stops) || (check_ra && (msg->flags & DNS_MESSAGEFLAG_RA) == 0 && l->recurse)) { + const char *err = (msg->rcode == dns_rcode_servfail && + !l->servfail_stops) + ? "SERVFAIL reply" + : "recursion not available"; dig_query_t *next = ISC_LIST_NEXT(query, link); if (l->current_query == query) { query_detach(&l->current_query); } if (next != NULL && (!l->ns_search_only || l->trace_root)) { + dighost_comments(l, + "Got %s from %s, trying next server", + err, query->servname); debug("sending query %p", next); if (l->tcp_mode) { start_tcp(next); } else { start_udp(next); } - dighost_comments(l, - "Got %s from %s, trying next " - "server", - msg->rcode == dns_rcode_servfail - ? "SERVFAIL reply" - : "recursion not available", - query->servname); if (check_if_queries_done(l, query)) { goto cancel_lookup; } goto detach_query; + } else { + dighost_comments(l, "Got %s from %s", err, + query->servname); } }