From b6bd2a53117d8e21f5ad5c7794da84846038ca47 Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Thu, 10 Mar 2022 17:30:34 +0000 Subject: [PATCH] Fix an issue in dig when retrying with the next server after SERVFAIL After a query results in a SERVFAIL result, and there is another registered query in the lookup's queries list, `dig` starts the next query to try another server, but for some reason, reports about that also when the current query is in the head of the list, even if there is no other query in the list to try. Use the same condition for both decisions, and after starting the next query, jump to the "detach_query" label instead of "next_lookup", because there is no need to start the next lookup after we just started a query in the current lookup. (cherry picked from commit e888c62fbd770e31f72b7d6bf08253d38ddc2e5d) --- bin/dig/dighost.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 10bf24fc13..bd0818d4f4 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -3923,15 +3923,6 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region, } else { start_udp(next); } - } - - /* - * If our query is at the head of the list and there - * is no next, we're the only one left, so fall - * through to print the message. - */ - if ((ISC_LIST_HEAD(l->q) != query) || - (ISC_LIST_NEXT(query, link) != NULL)) { dighost_comments(l, "Got %s from %s, trying next " "server", @@ -3939,7 +3930,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region, ? "SERVFAIL reply" : "recursion not available", query->servname); - goto next_lookup; + goto detach_query; } }