Skip to content

Commit

Permalink
Add pdns_control command to the the list of XFR domains in queue
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterlexis committed Jun 17, 2020
1 parent c6e4de5 commit 08949c8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions pdns/communicator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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<pair<DNSName, ComboAddress> > getSuckRequests();
private:
void loadArgsIntoSet(const char *listname, set<string> &listset);
void makeNotifySockets();
Expand Down
8 changes: 8 additions & 0 deletions pdns/dynhandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -404,3 +404,11 @@ string DLTokenLogin(const vector<string>&parts, Utility::pid_t ppid)
}
#endif
}

string DLSuckRequests(const vector<string> &parts, Utility::pid_t ppid) {
string ret;
for (auto const &d: Communicator.getSuckRequests()) {
ret += d.first.toString() + " " + d.second.toString() + "\n";
}
return ret;
}
1 change: 1 addition & 0 deletions pdns/dynhandler.hh
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ string DLNotifyRetrieveHandler(const vector<string>&parts, Utility::pid_t ppid);
string DLCurrentConfigHandler(const vector<string>&parts, Utility::pid_t ppid);
string DLListZones(const vector<string>&parts, Utility::pid_t ppid);
string DLTokenLogin(const vector<string>&parts, Utility::pid_t ppid);
string DLSuckRequests(const vector<string> &parts, Utility::pid_t ppid);
1 change: 1 addition & 0 deletions pdns/receiver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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", "<module> <slot> <pin>");
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")));
Expand Down
10 changes: 10 additions & 0 deletions pdns/slavecommunicator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1003,3 +1003,13 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P)
}
}
}

vector<pair<DNSName, ComboAddress> > CommunicatorClass::getSuckRequests() {
vector<pair<DNSName, ComboAddress> > ret;
std::lock_guard<std::mutex> 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;
}

0 comments on commit 08949c8

Please sign in to comment.