From 08949c81f253a4f82ef2c234553955980071f94e Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Tue, 16 Jun 2020 17:14:58 +0200 Subject: [PATCH] Add pdns_control command to the the list of XFR domains in queue --- pdns/communicator.hh | 1 + pdns/dynhandler.cc | 8 ++++++++ pdns/dynhandler.hh | 1 + pdns/receiver.cc | 1 + pdns/slavecommunicator.cc | 10 ++++++++++ 5 files changed, 21 insertions(+) diff --git a/pdns/communicator.hh b/pdns/communicator.hh index 643145c34923..9d718ba1f5f8 100644 --- a/pdns/communicator.hh +++ b/pdns/communicator.hh @@ -169,6 +169,7 @@ public: void retrievalLoopThread(); void sendNotification(int sock, const DNSName &domain, const ComboAddress& remote, uint16_t id, UeberBackend* B); bool notifyDomain(const DNSName &domain, UeberBackend* B); + vector > getSuckRequests(); private: void loadArgsIntoSet(const char *listname, set &listset); void makeNotifySockets(); diff --git a/pdns/dynhandler.cc b/pdns/dynhandler.cc index 4aef4a2f32fa..200f87ce27d4 100644 --- a/pdns/dynhandler.cc +++ b/pdns/dynhandler.cc @@ -404,3 +404,11 @@ string DLTokenLogin(const vector&parts, Utility::pid_t ppid) } #endif } + +string DLSuckRequests(const vector &parts, Utility::pid_t ppid) { + string ret; + for (auto const &d: Communicator.getSuckRequests()) { + ret += d.first.toString() + " " + d.second.toString() + "\n"; + } + return ret; +} diff --git a/pdns/dynhandler.hh b/pdns/dynhandler.hh index 6ac9d982ead8..8bcf8c5744b4 100644 --- a/pdns/dynhandler.hh +++ b/pdns/dynhandler.hh @@ -54,3 +54,4 @@ string DLNotifyRetrieveHandler(const vector&parts, Utility::pid_t ppid); string DLCurrentConfigHandler(const vector&parts, Utility::pid_t ppid); string DLListZones(const vector&parts, Utility::pid_t ppid); string DLTokenLogin(const vector&parts, Utility::pid_t ppid); +string DLSuckRequests(const vector &parts, Utility::pid_t ppid); diff --git a/pdns/receiver.cc b/pdns/receiver.cc index da65e8bf2591..eff859df0312 100644 --- a/pdns/receiver.cc +++ b/pdns/receiver.cc @@ -590,6 +590,7 @@ int main(int argc, char **argv) DynListener::registerFunc("CURRENT-CONFIG",&DLCurrentConfigHandler, "retrieve the current configuration", "[diff|default]"); DynListener::registerFunc("LIST-ZONES",&DLListZones, "show list of zones", "[master|slave|native]"); DynListener::registerFunc("TOKEN-LOGIN", &DLTokenLogin, "Login to a PKCS#11 token", " "); + DynListener::registerFunc("XFR-QUEUE", &DLSuckRequests, "Get all requests for XFR in queue"); if(!::arg()["tcp-control-address"].empty()) { DynListener* dlTCP=new DynListener(ComboAddress(::arg()["tcp-control-address"], ::arg().asNum("tcp-control-port"))); diff --git a/pdns/slavecommunicator.cc b/pdns/slavecommunicator.cc index 1794cc025464..d46020e1472a 100644 --- a/pdns/slavecommunicator.cc +++ b/pdns/slavecommunicator.cc @@ -1003,3 +1003,13 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P) } } } + +vector > CommunicatorClass::getSuckRequests() { + vector > ret; + std::lock_guard l(d_lock); + ret.reserve(d_suckdomains.size()); + for (auto const &d : d_suckdomains) { + ret.push_back(make_pair(d.domain, d.master)); + } + return ret; +}