]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
rctx_resend() increment query counters
authorColin Vidal <colin@isc.org>
Tue, 7 Apr 2026 20:18:58 +0000 (22:18 +0200)
committerColin Vidal <colin@isc.org>
Thu, 30 Apr 2026 14:23:23 +0000 (16:23 +0200)
Calls to `rctx_resend()` are done internally within the resolver, in
flow which are not supposed to happens more than once. For instance,
if some query fails, and a specific flag "F" wasn't set, then set the
flag and try again. This wouldn't occur more than once because if the
query fails the next attempt, the flag "F" would be set already, so the
resolver would move to the next server (or give up).

However, a subtle bug missing checking a flag, for instance, could lead
to an unbounded loop re-trying to query the same server. This is now
impossible as `rctx_resend()` also increment the query counters (so if
such case occurs, it would stop once the maximum limit is reached).

(cherry picked from commit b863694b32f8f764ae7475939888aebe99425b90)

lib/dns/resolver.c

index 2fdadceb088dceee8f4e94177e702e3a625b46dc..4fbe31ad815f08b9a5adf0e9e0cd6594651f0203 100644 (file)
@@ -10107,6 +10107,13 @@ rctx_resend(respctx_t *rctx, dns_adbaddrinfo_t *addrinfo) {
        unsigned int bucketnum;
 
        FCTXTRACE("resend");
+
+       result = incr_query_counters(fctx);
+       if (result != ISC_R_SUCCESS) {
+               fctx_done(fctx, DNS_R_SERVFAIL, __LINE__);
+               return;
+       }
+
        inc_stats(fctx->res, dns_resstatscounter_retry);
        fctx_increference(fctx);
        result = fctx_query(fctx, addrinfo, rctx->retryopts);