From 7502dc5b217c21d0c0784b609601634414cafacf Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Fri, 20 Feb 2026 14:26:24 +0100 Subject: [PATCH] Pass a Logr::logr_t down AXFRRetriever and TSIGTCPVerifier. NFC yet. Signed-off-by: Miod Vallat --- pdns/Makefile.am | 7 ++++++- pdns/auth-secondarycommunicator.cc | 2 +- pdns/axfr-retriever.cc | 5 +++-- pdns/axfr-retriever.hh | 6 ++++-- pdns/ixfr.cc | 2 +- pdns/ixfrdist.cc | 2 +- pdns/ixplore.cc | 2 +- pdns/recursordist/rec-xfr.cc | 2 +- pdns/recursordist/rec-zonetocache.cc | 2 +- pdns/recursordist/rpzloader.cc | 2 +- pdns/tsig-tests.cc | 2 +- pdns/tsigverifier.hh | 4 +++- 12 files changed, 24 insertions(+), 14 deletions(-) diff --git a/pdns/Makefile.am b/pdns/Makefile.am index 2f375d6126..a53dd896ec 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -245,6 +245,7 @@ pdns_server_SOURCES = \ lock.hh \ logger.cc logger.hh \ logging.hh \ + logr.hh \ lua-auth4.cc lua-auth4.hh \ lua-base4.cc lua-base4.hh \ misc.cc misc.hh \ @@ -741,7 +742,8 @@ ixfrdist_SOURCES = \ ixfrdist-web.hh ixfrdist-web.cc \ ixfrdist.cc \ ixfrutils.cc ixfrutils.hh \ - logger.cc logger.hh\ + logger.cc logger.hh \ + logr.hh \ misc.cc misc.hh \ mplexer.hh \ nsecrecords.cc \ @@ -811,6 +813,7 @@ ixplore_SOURCES = \ ixfrutils.cc ixfrutils.hh \ ixplore.cc \ logger.cc \ + logr.hh \ misc.cc misc.hh \ nsecrecords.cc \ qtype.cc \ @@ -919,6 +922,7 @@ tsig_tests_SOURCES = \ gss_context.cc gss_context.hh \ iputils.cc \ logger.cc \ + logr.hh \ misc.cc misc.hh \ nsecrecords.cc \ qtype.cc \ @@ -1379,6 +1383,7 @@ testrunner_SOURCES = \ iputils.cc \ ixfr.cc ixfr.hh \ logger.cc \ + logr.hh \ lua-auth4.hh lua-auth4.cc \ lua-base4.hh lua-base4.cc \ misc.cc \ diff --git a/pdns/auth-secondarycommunicator.cc b/pdns/auth-secondarycommunicator.cc index e3253d24ff..4bb566e346 100644 --- a/pdns/auth-secondarycommunicator.cc +++ b/pdns/auth-secondarycommunicator.cc @@ -593,7 +593,7 @@ static vector doAxfr(const TSIGTriplet& tt, const ComboAddres { uint16_t axfr_timeout = ::arg().asNum("axfr-fetch-timeout"); vector rrs; - AXFRRetriever retriever(ctx.remote, ctx.domain.zone, tt, (laddr.sin4.sin_family == 0) ? nullptr : &laddr, ((size_t)::arg().asNum("xfr-max-received-mbytes")) * 1024 * 1024, axfr_timeout); + AXFRRetriever retriever(nullptr /* TEMPORARY PLUMBING */, ctx.remote, ctx.domain.zone, tt, (laddr.sin4.sin_family == 0) ? nullptr : &laddr, ((size_t)::arg().asNum("xfr-max-received-mbytes")) * 1024 * 1024, axfr_timeout); Resolver::res_t recs; bool first = true; bool firstNSEC3{true}; diff --git a/pdns/axfr-retriever.cc b/pdns/axfr-retriever.cc index cf06af5331..215ce41ec1 100644 --- a/pdns/axfr-retriever.cc +++ b/pdns/axfr-retriever.cc @@ -29,13 +29,14 @@ using pdns::resolver::parseResult; -AXFRRetriever::AXFRRetriever(const ComboAddress& remote, +AXFRRetriever::AXFRRetriever(Logr::log_t slog, + const ComboAddress& remote, const ZoneName& domain, const TSIGTriplet& tsigConf, const ComboAddress* laddr, size_t maxReceivedBytes, uint16_t timeout) : - d_buf(65536), d_tsigVerifier(tsigConf, remote, d_trc), d_maxReceivedBytes(maxReceivedBytes) + d_tsigVerifier(slog, tsigConf, remote, d_trc), d_buf(65536), d_maxReceivedBytes(maxReceivedBytes) { ComboAddress local; if (laddr != nullptr) { diff --git a/pdns/axfr-retriever.hh b/pdns/axfr-retriever.hh index a2542a0301..016d424c8a 100644 --- a/pdns/axfr-retriever.hh +++ b/pdns/axfr-retriever.hh @@ -24,12 +24,14 @@ #include "iputils.hh" #include "dnsname.hh" +#include "logr.hh" #include "resolver.hh" class AXFRRetriever : public boost::noncopyable { public: - AXFRRetriever(const ComboAddress& remote, + AXFRRetriever(Logr::log_t slog, + const ComboAddress& remote, const ZoneName& zone, const TSIGTriplet& tt = TSIGTriplet(), const ComboAddress* laddr = NULL, @@ -43,13 +45,13 @@ class AXFRRetriever : public boost::noncopyable int getLength(uint16_t timeout); void timeoutReadn(uint16_t bytes, uint16_t timeoutsec=10); + TSIGTCPVerifier d_tsigVerifier; std::vector d_buf; string d_domain; int d_sock; int d_soacount; ComboAddress d_remote; TSIGRecordContent d_trc; - TSIGTCPVerifier d_tsigVerifier; size_t d_receivedBytes{0}; size_t d_maxReceivedBytes; diff --git a/pdns/ixfr.cc b/pdns/ixfr.cc index 93404f15d7..7cef1daa61 100644 --- a/pdns/ixfr.cc +++ b/pdns/ixfr.cc @@ -142,7 +142,7 @@ vector, vector>> getIXFRDeltas(const ComboAddr pw.commit(); TSIGRecordContent trc; - TSIGTCPVerifier tsigVerifier(tt, primary, trc); + TSIGTCPVerifier tsigVerifier(nullptr /* TEMPORARY PLUMBING */, tt, primary, trc); if(!tt.algo.empty()) { TSIGHashEnum the; getTSIGHashEnum(tt.algo, the); diff --git a/pdns/ixfrdist.cc b/pdns/ixfrdist.cc index a779fb9459..bc6c18101e 100644 --- a/pdns/ixfrdist.cc +++ b/pdns/ixfrdist.cc @@ -517,7 +517,7 @@ static void updateThread(const string& workdir, const uint16_t& keep, const uint uint32_t soaTTL = 0; records_t records; try { - AXFRRetriever axfr(primary, domain, tt, &local); + AXFRRetriever axfr(nullptr /* no structured logging */, primary, domain, tt, &local); uint32_t nrecords=0; Resolver::res_t nop; vector chunk; diff --git a/pdns/ixplore.cc b/pdns/ixplore.cc index 1b2fac69d7..816db07b38 100644 --- a/pdns/ixplore.cc +++ b/pdns/ixplore.cc @@ -145,7 +145,7 @@ int main(int argc, char** argv) { cout<<"Could not load zone from disk: "< chunk; diff --git a/pdns/recursordist/rec-xfr.cc b/pdns/recursordist/rec-xfr.cc index d50daeacea..33c2e0c7a0 100644 --- a/pdns/recursordist/rec-xfr.cc +++ b/pdns/recursordist/rec-xfr.cc @@ -183,7 +183,7 @@ static shared_ptr loadZoneFromServer(Logr::log_t plogger local = pdns::getQueryLocalAddress(primary.sin4.sin_family, 0); } - AXFRRetriever axfr(primary, zoneName, tsigTriplet, &local, maxReceivedBytes, axfrTimeout); + AXFRRetriever axfr(logger, primary, zoneName, tsigTriplet, &local, maxReceivedBytes, axfrTimeout); unsigned int nrecords = 0; Resolver::res_t nop; vector chunk; diff --git a/pdns/recursordist/rec-zonetocache.cc b/pdns/recursordist/rec-zonetocache.cc index c5c33bb067..4ac8358d5f 100644 --- a/pdns/recursordist/rec-zonetocache.cc +++ b/pdns/recursordist/rec-zonetocache.cc @@ -146,7 +146,7 @@ pdns::ZoneMD::Result ZoneData::getByAXFR(const RecZoneToCache::Config& config, p local = pdns::getQueryLocalAddress(primary.sin4.sin_family, 0); } - AXFRRetriever axfr(primary, d_zone, tsigTriplet, &local, maxReceivedBytes, axfrTimeout); + AXFRRetriever axfr(d_log, primary, d_zone, tsigTriplet, &local, maxReceivedBytes, axfrTimeout); Resolver::res_t nop; vector chunk; time_t axfrStart = time(nullptr); diff --git a/pdns/recursordist/rpzloader.cc b/pdns/recursordist/rpzloader.cc index 06bece64d2..4cca1eff18 100644 --- a/pdns/recursordist/rpzloader.cc +++ b/pdns/recursordist/rpzloader.cc @@ -252,7 +252,7 @@ static shared_ptr loadRPZFromServer(Logr::log_t plogger, local = pdns::getQueryLocalAddress(primary.sin4.sin_family, 0); } - AXFRRetriever axfr(primary, zoneName, tsigTriplet, &local, maxReceivedBytes, axfrTimeout); + AXFRRetriever axfr(logger, primary, zoneName, tsigTriplet, &local, maxReceivedBytes, axfrTimeout); unsigned int nrecords = 0; Resolver::res_t nop; vector chunk; diff --git a/pdns/tsig-tests.cc b/pdns/tsig-tests.cc index 7b13f325b3..e8601a5c20 100644 --- a/pdns/tsig-tests.cc +++ b/pdns/tsig-tests.cc @@ -64,7 +64,7 @@ try tt.name=keyname; tt.algo=g_hmacmd5dnsname; tt.secret=key; - AXFRRetriever axfr(dest, ZoneName("b.aa"), tt); + AXFRRetriever axfr(nullptr, dest, ZoneName("b.aa"), tt); vector res; while(axfr.getChunk(res)) { } diff --git a/pdns/tsigverifier.hh b/pdns/tsigverifier.hh index 84b87ebd2c..631a1acc64 100644 --- a/pdns/tsigverifier.hh +++ b/pdns/tsigverifier.hh @@ -3,15 +3,17 @@ #include "dnsrecords.hh" #include "iputils.hh" +#include "logr.hh" class TSIGTCPVerifier { public: - TSIGTCPVerifier(const TSIGTriplet& tt, const ComboAddress& remote, TSIGRecordContent& trc): d_tt(tt), d_remote(remote), d_trc(trc) + TSIGTCPVerifier(Logr::log_t slog, const TSIGTriplet& tt, const ComboAddress& remote, TSIGRecordContent& trc): d_slog(slog), d_tt(tt), d_remote(remote), d_trc(trc) { } bool check(const string& data, const MOADNSParser& mdp); private: + Logr::log_t d_slog; const TSIGTriplet& d_tt; const ComboAddress& d_remote; TSIGRecordContent& d_trc; -- 2.47.3