]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Try next server on resolver timeout
authorOndřej Surý <ondrej@isc.org>
Mon, 12 Dec 2022 11:06:01 +0000 (12:06 +0100)
committerOndřej Surý <ondrej@isc.org>
Wed, 14 Dec 2022 17:49:18 +0000 (18:49 +0100)
Instead of resending to the same server on the (dispatch) timeout in the
resolver, try the next server.

lib/dns/resolver.c

index 02b527365c08813e76716f0ab4ef864610479c4e..c78402a4e9ea7214755fadb3bfcea0615b17b228 100644 (file)
@@ -8041,19 +8041,16 @@ rctx_timedout(respctx_t *rctx) {
                isc_time_now(&now);
                /* netmgr timeouts are accurate to the millisecond */
                if (isc_time_microdiff(&fctx->expires, &now) < US_PER_MS) {
-                       FCTXTRACE("stopped trying to make fetch happen");
+                       FCTXTRACE("query timed out; stopped trying to make "
+                                 "fetch happen");
                } else {
-                       FCTXTRACE("query timed out; no response");
+                       FCTXTRACE("query timed out; trying next server");
+                       /* try next server */
                        rctx->no_response = true;
                        rctx->finish = NULL;
-                       if (!ISFORWARDER(rctx->query->addrinfo) ||
-                           fctx->fwdpolicy != dns_fwdpolicy_first)
-                       {
-                               rctx->resend = true;
-                       }
+                       rctx->next_server = true;
                }
 
-               FCTXTRACE("timed out");
                rctx_done(rctx, rctx->result);
                return (ISC_R_COMPLETE);
        }
@@ -9759,10 +9756,11 @@ rctx_done(respctx_t *rctx, isc_result_t result) {
        fctx_cancelquery(&query, rctx->finish, rctx->no_response, false);
 
        /*
-        * If nobody's waiting for results, don't resend.
+        * If nobody's waiting for results, don't resend or try next server.
         */
        LOCK(&fctx->lock);
        if (ISC_LIST_EMPTY(fctx->events)) {
+               rctx->next_server = false;
                rctx->resend = false;
        }
        UNLOCK(&fctx->lock);