From: Charles-Henri Bruyand Date: Fri, 15 Oct 2021 14:11:45 +0000 (+0200) Subject: rec: only initialize NOD logger if it might be used X-Git-Tag: rec-4.6.0-alpha2~11^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F10843%2Fhead;p=thirdparty%2Fpdns.git rec: only initialize NOD logger if it might be used --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 5f63ed0f9c..8b73770488 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1606,7 +1606,10 @@ static void startDoResolve(void *p) bool addPaddingToResponse = false; #ifdef NOD_ENABLED bool hasUDR = false; - auto nodlogger = g_slog->withName("nod")->v(1)->withValues("qname", Logging::Loggable(dc->d_mdp.d_qname)); + std::shared_ptr nodlogger{nullptr}; + if (g_udrEnabled || g_nodEnabled) { + nodlogger = g_slog->withName("nod")->v(1)->withValues("qname", Logging::Loggable(dc->d_mdp.d_qname)); + } #endif /* NOD_ENABLED */ DNSPacketWriter::optvect_t returnedEdnsOptions; // Here we stuff all the options for the return packet uint8_t ednsExtRCode = 0;