From f317f0319d4ef475f82f276db8781bc3feb929a1 Mon Sep 17 00:00:00 2001 From: Otto Date: Fri, 19 Mar 2021 09:06:01 +0100 Subject: [PATCH] Backport 10185 to 4.3.x: 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 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, -- 2.47.2