From: Otto Date: Fri, 19 Mar 2021 07:57:37 +0000 (+0100) Subject: Backport #10185: make sure we take the right minimum for the PC TTL data in the SERVF... X-Git-Tag: rec-4.4.3~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F10192%2Fhead;p=thirdparty%2Fpdns.git Backport #10185: make sure we take the right minimum for the PC TTL data in the SERVFAIL case. --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index f94c206f55..9f63e38293 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1855,11 +1855,12 @@ static void startDoResolve(void *p) g_stats.variableResponses++; } if(!SyncRes::s_nopacketcache && !variableAnswer && !sr.wasVariable() ) { + minTTL = min(minTTL, pw.getHeader()->rcode == RCode::ServFail ? SyncRes::s_packetcacheservfailttl : + SyncRes::s_packetcachettl); t_packetCache->insertResponsePacket(dc->d_tag, dc->d_qhash, std::move(dc->d_query), dc->d_mdp.d_qname, dc->d_mdp.d_qtype, dc->d_mdp.d_qclass, string((const char*)&*packet.begin(), packet.size()), g_now.tv_sec, - pw.getHeader()->rcode == RCode::ServFail ? SyncRes::s_packetcacheservfailttl : - min(minTTL,SyncRes::s_packetcachettl), + minTTL, dq.validationState, dc->d_ecsBegin, dc->d_ecsEnd,