From 99c2bf54d0a2efbd69bcd9e4091f27bd7211cbfc Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Fri, 8 Oct 2021 07:35:32 +0200 Subject: [PATCH] Condition covering NoError, NXDomain and missing records properly Co-authored-by: Remi Gacogne --- pdns/pdns_recursor.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index f838e23e7e..38860b4070 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -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); -- 2.47.2