From: Aki Tuomi Date: Fri, 14 Feb 2020 11:20:01 +0000 (+0200) Subject: communicator: Allow forcing domain retrieval X-Git-Tag: rec-4.4.0-beta1~25^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=65ebb95149e03d625fb621a85159bed9e034aa9e;p=thirdparty%2Fpdns.git communicator: Allow forcing domain retrieval This allows forcing retrieval of domain that is not slave domain. --- diff --git a/pdns/communicator.cc b/pdns/communicator.cc index a58d35224d..fd1f168f0b 100644 --- a/pdns/communicator.cc +++ b/pdns/communicator.cc @@ -54,7 +54,7 @@ void CommunicatorClass::retrievalLoopThread(void) sr=d_suckdomains.front(); d_suckdomains.pop_front(); } - suck(sr.domain, sr.master); + suck(sr.domain, sr.master, sr.force); } } diff --git a/pdns/communicator.hh b/pdns/communicator.hh index 643145c349..c0ac4afd69 100644 --- a/pdns/communicator.hh +++ b/pdns/communicator.hh @@ -45,6 +45,7 @@ struct SuckRequest { DNSName domain; ComboAddress master; + bool force; bool operator<(const SuckRequest& b) const { return tie(domain, master) < tie(b.domain, b.master); @@ -161,7 +162,7 @@ public: void drillHole(const DNSName &domain, const string &ip); bool justNotified(const DNSName &domain, const string &ip); - void addSuckRequest(const DNSName &domain, const ComboAddress& master); + void addSuckRequest(const DNSName &domain, const ComboAddress& master, bool force=false); void addSlaveCheckRequest(const DomainInfo& di, const ComboAddress& remote); void addTrySuperMasterRequest(const DNSPacket& p); void notify(const DNSName &domain, const string &ip); @@ -176,7 +177,7 @@ private: int d_nsock4, d_nsock6; map,time_t>d_holes; std::mutex d_holelock; - void suck(const DNSName &domain, const ComboAddress& remote); + void suck(const DNSName &domain, const ComboAddress& remote, bool force=false); void ixfrSuck(const DNSName &domain, const TSIGTriplet& tt, const ComboAddress& laddr, const ComboAddress& remote, std::unique_ptr& pdl, ZoneStatus& zs, vector* axfr); diff --git a/pdns/receiver.cc b/pdns/receiver.cc index 90a42e3269..3be7c8c1e0 100644 --- a/pdns/receiver.cc +++ b/pdns/receiver.cc @@ -586,7 +586,7 @@ int main(int argc, char **argv) DynListener::registerFunc("RESPSIZES", &DLRSizesHandler, "get histogram of response sizes"); DynListener::registerFunc("REMOTES", &DLRemotesHandler, "get top remotes"); DynListener::registerFunc("SET",&DLSettingsHandler, "set config variables", " "); - DynListener::registerFunc("RETRIEVE",&DLNotifyRetrieveHandler, "retrieve slave domain", ""); + DynListener::registerFunc("RETRIEVE",&DLNotifyRetrieveHandler, "retrieve slave domain", " []"); DynListener::registerFunc("CURRENT-CONFIG",&DLCurrentConfigHandler, "retrieve the current configuration", "[diff]"); DynListener::registerFunc("LIST-ZONES",&DLListZones, "show list of zones", "[master|slave|native]"); DynListener::registerFunc("TOKEN-LOGIN", &DLTokenLogin, "Login to a PKCS#11 token", " "); diff --git a/pdns/slavecommunicator.cc b/pdns/slavecommunicator.cc index 7ab50744b8..d2d8892b86 100644 --- a/pdns/slavecommunicator.cc +++ b/pdns/slavecommunicator.cc @@ -48,12 +48,13 @@ #include "ixfr.hh" -void CommunicatorClass::addSuckRequest(const DNSName &domain, const ComboAddress& master) +void CommunicatorClass::addSuckRequest(const DNSName &domain, const ComboAddress& master, bool force) { std::lock_guard l(d_lock); SuckRequest sr; sr.domain = domain; sr.master = master; + sr.force = force; pair res; res=d_suckdomains.push_back(sr); @@ -293,7 +294,7 @@ static vector doAxfr(const ComboAddress& raddr, const DNSName } -void CommunicatorClass::suck(const DNSName &domain, const ComboAddress& remote) +void CommunicatorClass::suck(const DNSName &domain, const ComboAddress& remote, bool force) { { std::lock_guard l(d_lock); @@ -314,7 +315,7 @@ void CommunicatorClass::suck(const DNSName &domain, const ComboAddress& remote) DNSSECKeeper dk (&B); // reuse our UeberBackend copy for DNSSECKeeper bool wrongDomainKind = false; // this checks three error conditions & sets wrongDomainKind if we hit the third - if(!B.getDomainInfo(domain, di) || !di.backend || (wrongDomainKind = true, di.kind != DomainInfo::Slave)) { // di.backend and B are mostly identical + if(!B.getDomainInfo(domain, di) || !di.backend || (wrongDomainKind = true, !force && di.kind != DomainInfo::Slave)) { // di.backend and B are mostly identical if(wrongDomainKind) g_log<