]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Backport #10185: make sure we take the right minimum for the PC TTL data in the SERVF... 10192/head
authorOtto <otto.moerbeek@open-xchange.com>
Fri, 19 Mar 2021 07:57:37 +0000 (08:57 +0100)
committerOtto <otto.moerbeek@open-xchange.com>
Fri, 19 Mar 2021 07:57:37 +0000 (08:57 +0100)
pdns/pdns_recursor.cc

index f94c206f556a7cd06705071f473f31835463c4f1..9f63e3829315f311c419a1ae03d8b18baadf31bd 100644 (file)
@@ -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,