]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Also log in the non-structured logging case 12750/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 15 May 2023 09:49:17 +0000 (11:49 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 15 May 2023 10:29:50 +0000 (12:29 +0200)
pdns/recursordist/pdns_recursor.cc

index a52d3289a5b8d31cbb2375de8b36887e2fdb37c8..7f8a91a17967f942dea5f8ce90cff45fe5f4c55e 100644 (file)
@@ -893,7 +893,7 @@ static uint32_t capPacketCacheTTL(const struct dnsheader& hdr, uint32_t ttl, boo
   return ttl;
 }
 
-void startDoResolve(void* p)
+void startDoResolve(void* p) // NOLINT(readability-function-cognitive-complexity): https://github.com/PowerDNS/pdns/issues/12791
 {
   auto dc = std::unique_ptr<DNSComboWriter>(reinterpret_cast<DNSComboWriter*>(p));
   SyncRes sr(dc->d_now);
@@ -1673,7 +1673,8 @@ void startDoResolve(void* p)
 #endif
     }
 
-    if (g_packetCache && !variableAnswer && !sr.wasVariable()) {
+    const bool intoPC = g_packetCache && !variableAnswer && !sr.wasVariable();
+    if (intoPC) {
       minTTL = capPacketCacheTTL(*pw.getHeader(), minTTL, seenAuthSOA);
       g_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,
@@ -1788,6 +1789,7 @@ void startDoResolve(void* p)
         if (!shouldNotValidate && sr.isDNSSECValidationRequested()) {
           g_log << ", dnssec=" << sr.getValidationState();
         }
+        g_log << " answer-is-variable=" << sr.wasVariable() << ", into-packetcache=" << intoPC;
         g_log << endl;
       }
       else {
@@ -1804,7 +1806,7 @@ void startDoResolve(void* p)
                         "rcode", Logging::Loggable(res),
                         "validationState", Logging::Loggable(sr.getValidationState()),
                         "answer-is-variable", Logging::Loggable(sr.wasVariable()),
-                        "into-packetcache", Logging::Loggable(g_packetCache && !variableAnswer && !sr.wasVariable()));
+                        "into-packetcache", Logging::Loggable(intoPC));
       }
     }