]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Pass a Logr::logr_t down AXFRRetriever and TSIGTCPVerifier. NFC yet. 16920/head
authorMiod Vallat <miod.vallat@powerdns.com>
Fri, 20 Feb 2026 13:26:24 +0000 (14:26 +0100)
committerMiod Vallat <miod.vallat@powerdns.com>
Thu, 26 Feb 2026 13:22:49 +0000 (14:22 +0100)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
12 files changed:
pdns/Makefile.am
pdns/auth-secondarycommunicator.cc
pdns/axfr-retriever.cc
pdns/axfr-retriever.hh
pdns/ixfr.cc
pdns/ixfrdist.cc
pdns/ixplore.cc
pdns/recursordist/rec-xfr.cc
pdns/recursordist/rec-zonetocache.cc
pdns/recursordist/rpzloader.cc
pdns/tsig-tests.cc
pdns/tsigverifier.hh

index 2f375d6126d0ad371ba1631a33fa1e03d203d4a3..a53dd896ec813aec170789be5d69bec4cae7993f 100644 (file)
@@ -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 \
index e3253d24ff16b011fa36218f21635e905424d7a0..4bb566e3461305b85f4c9445d9a2aa512c19cba8 100644 (file)
@@ -593,7 +593,7 @@ static vector<DNSResourceRecord> doAxfr(const TSIGTriplet& tt, const ComboAddres
 {
   uint16_t axfr_timeout = ::arg().asNum("axfr-fetch-timeout");
   vector<DNSResourceRecord> 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};
index cf06af5331bbe86e4b64b8f3f647166d3f97039e..215ce41ec1e025072cccb1774b272f4f332879ba 100644 (file)
 
 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) {
index a2542a0301b0406c0a92c6f0374f75dc06e3b7c0..016d424c8acbe02da9570381af4d4b8137cd56df 100644 (file)
 
 #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<char> 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;
index 93404f15d76af7f1f418a5d34b7747b180352235..7cef1daa61b8fa62d0efbe98e7bc008094d5d9c4 100644 (file)
@@ -142,7 +142,7 @@ vector<pair<vector<DNSRecord>, vector<DNSRecord>>> 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);
index a779fb94599d8a1b418ce5c4842d94b2377fc1e6..bc6c18101e6b55a534836de68dc2f35cbf430fcd 100644 (file)
@@ -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<DNSRecord> chunk;
index 1b2fac69d71390249544143328f389dc4f75b76f..816db07b3876d41a01b18a9a89f14e7c438af951 100644 (file)
@@ -145,7 +145,7 @@ int main(int argc, char** argv) {
       cout<<"Could not load zone from disk: "<<e.what()<<endl;
       cout << "Retrieving latest from primary " << primary.toStringWithPort() << endl;
       ComboAddress local = primary.sin4.sin_family == AF_INET ? ComboAddress("0.0.0.0") : ComboAddress("::");
-      AXFRRetriever axfr(primary, zone, tt, &local);
+      AXFRRetriever axfr(nullptr /* no structured logging */, primary, zone, tt, &local);
       unsigned int nrecords=0;
       Resolver::res_t nop;
       vector<DNSRecord> chunk;
index d50daeacea18d32eae7b9d24ca728b0945df9601..33c2e0c7a02a93977b07d4f2b65690cc0097ca71 100644 (file)
@@ -183,7 +183,7 @@ static shared_ptr<const SOARecordContent> 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<DNSRecord> chunk;
index c5c33bb067a15752a5905935e5c2f37f921eb4a4..4ac8358d5fe514478fc9d0b571e4ac7051ce99d7 100644 (file)
@@ -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<DNSRecord> chunk;
   time_t axfrStart = time(nullptr);
index 06bece64d2c55b5bab9656848bdba6fa35bd81ca..4cca1eff189744824cb3469bbb12d57ac4d0a704 100644 (file)
@@ -252,7 +252,7 @@ static shared_ptr<const SOARecordContent> 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<DNSRecord> chunk;
index 7b13f325b3b6029e57e81c6a6bfdb519d9314751..e8601a5c202986419a4ac7b707bb245d47dd7e4b 100644 (file)
@@ -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<DNSResourceRecord> res;
   while(axfr.getChunk(res)) {
   }
index 84b87ebd2cdad563070eb46393d20a8552236883..631a1acc64f2dbbf60bb948393666342bac22490 100644 (file)
@@ -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;