From: Otto Moerbeek Date: Fri, 1 Mar 2024 14:36:13 +0000 (+0100) Subject: remove unused branch in SLOG macro (ifdef RECURSOR) X-Git-Tag: rec-5.1.0-alpha1~87^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fbc34aabca59da78519a30995c0fa12b099630a0;p=thirdparty%2Fpdns.git remove unused branch in SLOG macro (ifdef RECURSOR) --- diff --git a/pdns/logging.hh b/pdns/logging.hh index edde72d4b3..2f1d0f2c78 100644 --- a/pdns/logging.hh +++ b/pdns/logging.hh @@ -220,12 +220,7 @@ constexpr bool g_slogStructured = true; // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define SLOG(oldStyle, slogCall) \ do { \ - if (g_slogStructured) { \ - slogCall; \ - } \ - else { \ - oldStyle; \ - } \ + slogCall; \ } while (0) #else // No structured logging (e.g. auth) diff --git a/pdns/recursordist/pdns_recursor.cc b/pdns/recursordist/pdns_recursor.cc index fc22f0dfbd..6f08ad4983 100644 --- a/pdns/recursordist/pdns_recursor.cc +++ b/pdns/recursordist/pdns_recursor.cc @@ -388,14 +388,6 @@ static void updateResponseStats(int res, const ComboAddress& remote, unsigned in } } -static string makeLoginfo(const std::unique_ptr& comboWriter) -try { - return "(" + comboWriter->d_mdp.d_qname.toLogString() + "/" + DNSRecordContent::NumberToType(comboWriter->d_mdp.d_qtype) + " from " + (comboWriter->getRemote()) + ")"; -} -catch (...) { - return "Exception making error message for exception"; -} - /** * Chases the CNAME provided by the PolicyCustom RPZ policy. * @@ -2675,7 +2667,7 @@ void makeUDPServerSockets(deferredAdd_t& deferredAdds, Logr::log_t log) if (address.sin6.sin6_family == AF_INET6 && setsockopt(socketFd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one)) < 0) { int err = errno; SLOG(g_log << Logger::Warning << "Failed to set IPv6 socket to IPv6 only, continuing anyhow: " << stringerror(err) << endl, - log->error(Logr::Warning, "Failed to set IPv6 socket to IPv6 only, continuing anyhow")); + log->error(Logr::Warning, err, "Failed to set IPv6 socket to IPv6 only, continuing anyhow")); } } if (::arg().mustDo("non-local-bind")) { diff --git a/pdns/recursordist/rpzloader.cc b/pdns/recursordist/rpzloader.cc index 478631363e..4b28464edb 100644 --- a/pdns/recursordist/rpzloader.cc +++ b/pdns/recursordist/rpzloader.cc @@ -377,7 +377,7 @@ std::shared_ptr loadRPZFromFile(const std::string& fname return soaRecordContent; } -static bool dumpZoneToDisk(Logr::log_t logger, const DNSName& zoneName, const std::shared_ptr& newZone, const std::string& dumpZoneFileName) +static bool dumpZoneToDisk(Logr::log_t logger, const std::shared_ptr& newZone, const std::string& dumpZoneFileName) { logger->info(Logr::Debug, "Dumping zone to disk", "destination_file", Logging::Loggable(dumpZoneFileName)); std::string temp = dumpZoneFileName + "XXXXXX"; @@ -465,7 +465,7 @@ static void preloadRPZFIle(RPZTrackerParams& params, const DNSName& zoneName, st }); if (!params.dumpZoneFileName.empty()) { - dumpZoneToDisk(logger, zoneName, newZone, params.dumpZoneFileName); + dumpZoneToDisk(logger, newZone, params.dumpZoneFileName); } /* no need to try another primary */ @@ -659,7 +659,7 @@ static bool RPZTrackerIteration(RPZTrackerParams& params, const DNSName& zoneNam }); if (!params.dumpZoneFileName.empty()) { - dumpZoneToDisk(logger, zoneName, newZone, params.dumpZoneFileName); + dumpZoneToDisk(logger, newZone, params.dumpZoneFileName); } refresh = std::max(params.refreshFromConf != 0 ? params.refreshFromConf : newZone->getRefresh(), 1U); }