]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Enable lame response detection even with disabled lame cache
authorOndřej Surý <ondrej@sury.org>
Fri, 24 Sep 2021 07:48:50 +0000 (09:48 +0200)
committerMichał Kępień <michal@isc.org>
Mon, 11 Oct 2021 11:23:25 +0000 (13:23 +0200)
Previously, when lame cache would be disabled by setting lame-ttl to 0,
it would also disable lame answer detection.  In this commit, we enable
the lame response detection even when the lame cache is disabled.  This
enables stopping answer processing early rather than going through the
whole answer processing flow.

lib/dns/resolver.c

index 8175f7918bcfff7a2b9bbad2256cedda0019d558..b34cb12b73919da14e5c9c44004f65e139796ca7 100644 (file)
@@ -8489,18 +8489,20 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
        /*
         * Is the server lame?
         */
-       if (res->lame_ttl != 0 && !ISFORWARDER(query->addrinfo) &&
-           is_lame(fctx, rmessage)) {
+       if (!ISFORWARDER(query->addrinfo) && is_lame(fctx, rmessage)) {
                inc_stats(res, dns_resstatscounter_lame);
                log_lame(fctx, query->addrinfo);
-               result = dns_adb_marklame(fctx->adb, query->addrinfo,
-                                         &fctx->name, fctx->type,
-                                         now + res->lame_ttl);
-               if (result != ISC_R_SUCCESS)
-                       isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER,
-                                     DNS_LOGMODULE_RESOLVER, ISC_LOG_ERROR,
-                                     "could not mark server as lame: %s",
-                                     isc_result_totext(result));
+               if (res->lame_ttl != 0) {
+                       result = dns_adb_marklame(fctx->adb, query->addrinfo,
+                                                 &fctx->name, fctx->type,
+                                                 now + res->lame_ttl);
+                       if (result != ISC_R_SUCCESS) {
+                               isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER,
+                                             DNS_LOGMODULE_RESOLVER, ISC_LOG_ERROR,
+                                             "could not mark server as lame: %s",
+                                             isc_result_totext(result));
+                       }
+               }
                broken_server = DNS_R_LAME;
                keep_trying = true;
                FCTXTRACE("lame server");