From 535e6e57b9be33ac446ab2176446f0fb6d4d468e Mon Sep 17 00:00:00 2001 From: Otto Date: Fri, 19 Mar 2021 08:57:37 +0100 Subject: [PATCH] Backport #10185: make sure we take the right minimum for the PC TTL data in the SERVFAIL case. --- pdns/pdns_recursor.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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, -- 2.47.2