]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Condition covering NoError, NXDomain and missing records properly
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 8 Oct 2021 05:35:32 +0000 (07:35 +0200)
committerGitHub <noreply@github.com>
Fri, 8 Oct 2021 05:35:32 +0000 (07:35 +0200)
Co-authored-by: Remi Gacogne <github@coredump.fr>
pdns/pdns_recursor.cc

index f838e23e7ea5d0b3ad247aa507b514e7f890eaf8..38860b407011855418c6665d7f0885e33b06f4a0 100644 (file)
@@ -2300,7 +2300,8 @@ static void startDoResolve(void *p)
     }
     if (!SyncRes::s_nopacketcache && !variableAnswer && !sr.wasVariable()) {
       const auto& hdr = pw.getHeader();
-      if (hdr->ancount == 0 && hdr->rcode != RCode::NoError && hdr->rcode != RCode::NXDomain) {
+      if ((hdr->rcode != RCode::NoError && hdr->rcode != RCode::NXDomain) ||
+          (hdr->ancount == 0 && hdr->nscount == 0)) {
         minTTL = min(minTTL, SyncRes::s_packetcacheservfailttl);
       }
       minTTL = min(minTTL, SyncRes::s_packetcachettl);