From: Otto Date: Fri, 19 Mar 2021 08:06:01 +0000 (+0100) Subject: Backport 10185 to 4.3.x: make sure we take the right minimum for the PC TTL data... X-Git-Tag: rec-4.3.7^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F10193%2Fhead;p=thirdparty%2Fpdns.git Backport 10185 to 4.3.x: 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 ccb9bfa458..9485541cea 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1748,11 +1748,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,