]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Backport 10185 to 4.3.x: make sure we take the right minimum for the PC TTL data... 10193/head
authorOtto <otto.moerbeek@open-xchange.com>
Fri, 19 Mar 2021 08:06:01 +0000 (09:06 +0100)
committerOtto <otto.moerbeek@open-xchange.com>
Fri, 19 Mar 2021 08:06:01 +0000 (09:06 +0100)
pdns/pdns_recursor.cc

index ccb9bfa458a0910bc42539bbf13ea394a4afc0dc..9485541cea1d20f61f7b6cbef2c8ca127805a93c 100644 (file)
@@ -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,