From: Diego Fronza Date: Mon, 15 Feb 2021 22:28:50 +0000 (-0300) Subject: Don't retry +tcp queries on failure if tries=1 or retries=0 X-Git-Tag: v9.17.12~24^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=78f6ead480ce6c2f00410acfee1bcf9895e2cc09;p=thirdparty%2Fbind9.git Don't retry +tcp queries on failure if tries=1 or retries=0 Before this commit, a premature EOF (connection closed) on tcp queries was causing dig to automatically attempt to send the query again, even if +tries=1 or +retries=0 was provided on command line. This commit fix the problem by taking into account the no. of retries specified by the user when processing a premature EOF on tcp connections. --- diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 178c241708f..9d8a1e5a223 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -3117,7 +3117,8 @@ force_next(dig_query_t *query) { */ static void requeue_or_update_exitcode(dig_lookup_t *lookup) { - if (lookup->eoferr == 0U) { + if (lookup->eoferr == 0U && lookup->retries > 1) { + --lookup->retries; /* * Peer closed the connection prematurely for the first time * for this lookup. Try again, keeping track of this failure.