From: Otto Moerbeek Date: Mon, 15 May 2023 09:49:17 +0000 (+0200) Subject: Also log in the non-structured logging case X-Git-Tag: rec-4.9.0-beta1~20^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d46fe5d99755427dc11a8ea37e72656e9af0173;p=thirdparty%2Fpdns.git Also log in the non-structured logging case --- diff --git a/pdns/recursordist/pdns_recursor.cc b/pdns/recursordist/pdns_recursor.cc index a52d3289a5..7f8a91a179 100644 --- a/pdns/recursordist/pdns_recursor.cc +++ b/pdns/recursordist/pdns_recursor.cc @@ -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(reinterpret_cast(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)); } }