From: Kees Monshouwer Date: Wed, 8 Nov 2023 14:32:11 +0000 (+0100) Subject: replace slave by secondary in as many places as possible X-Git-Tag: rec-5.0.0-rc1~45^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c02c999b90648100710e830736fb9c242f720824;p=thirdparty%2Fpdns.git replace slave by secondary in as many places as possible --- diff --git a/modules/bindbackend/bindbackend2.cc b/modules/bindbackend/bindbackend2.cc index b9e756d6fe..481658453c 100644 --- a/modules/bindbackend/bindbackend2.cc +++ b/modules/bindbackend/bindbackend2.cc @@ -78,7 +78,7 @@ SharedLockGuarded Bind2Backend::s_state; int Bind2Backend::s_first = 1; bool Bind2Backend::s_ignore_broken_records = false; -std::mutex Bind2Backend::s_autoprimary_config_lock; // protects writes to config file +std::mutex Bind2Backend::s_autosecondary_config_lock; // protects writes to config file std::mutex Bind2Backend::s_startup_lock; string Bind2Backend::s_binddirectory; @@ -399,14 +399,14 @@ void Bind2Backend::getAllDomains(vector* domains, bool getSerial, bo } } -void Bind2Backend::getUnfreshSlaveInfos(vector* unfreshDomains) +void Bind2Backend::getUnfreshSecondaryInfos(vector* unfreshDomains) { vector domains; { auto state = s_state.read_lock(); domains.reserve(state->size()); for (const auto& i : *state) { - if (i.d_kind != DomainInfo::Slave) + if (i.d_kind != DomainInfo::Secondary) continue; DomainInfo sd; sd.id = i.d_id; @@ -414,7 +414,7 @@ void Bind2Backend::getUnfreshSlaveInfos(vector* unfreshDomains) sd.primaries = i.d_primaries; sd.last_check = i.d_lastcheck; sd.backend = this; - sd.kind = DomainInfo::Slave; + sd.kind = DomainInfo::Secondary; domains.push_back(std::move(sd)); } } @@ -627,8 +627,8 @@ static void printDomainExtendedStatus(ostringstream& ret, const BB2DomainInfo& i case DomainInfo::Primary: ret << "Primary"; break; - case DomainInfo::Slave: - ret << "Slave"; + case DomainInfo::Secondary: + ret << "Secondary"; break; default: ret << "Native"; @@ -965,7 +965,7 @@ void Bind2Backend::loadConfig(string* status) // NOLINT(readability-function-cog kind = DomainInfo::Primary; } if (domain.type == "secondary" || domain.type == "slave") { - kind = DomainInfo::Slave; + kind = DomainInfo::Secondary; } bool kindChanged = (bbd.d_kind != kind); @@ -992,7 +992,7 @@ void Bind2Backend::loadConfig(string* status) // NOLINT(readability-function-cog catch (std::system_error& ae) { ostringstream msg; if (ae.code().value() == ENOENT && isNew && domain.type == "slave") - msg << " error at " + nowTime() << " no file found for new slave domain '" << domain.name << "'. Has not been AXFR'd yet"; + msg << " error at " + nowTime() << " no file found for new secondary domain '" << domain.name << "'. Has not been AXFR'd yet"; else msg << " error at " + nowTime() + " parsing '" << domain.name << "' from file '" << domain.filename << "': " << ae.what(); @@ -1413,7 +1413,7 @@ BB2DomainInfo Bind2Backend::createDomainEntry(const DNSName& domain, const strin return bbd; } -bool Bind2Backend::createSlaveDomain(const string& ip, const DNSName& domain, const string& /* nameserver */, const string& account) +bool Bind2Backend::createSecondaryDomain(const string& ip, const DNSName& domain, const string& /* nameserver */, const string& account) { string filename = getArg("autoprimary-destdir") + '/' + domain.toStringNoDot(); @@ -1422,7 +1422,7 @@ bool Bind2Backend::createSlaveDomain(const string& ip, const DNSName& domain, co << "' from autoprimary " << ip << endl; { - std::lock_guard l2(s_autoprimary_config_lock); + std::lock_guard l2(s_autosecondary_config_lock); ofstream c_of(getArg("autoprimary-config").c_str(), std::ios::app); if (!c_of) { @@ -1431,7 +1431,7 @@ bool Bind2Backend::createSlaveDomain(const string& ip, const DNSName& domain, co } c_of << endl; - c_of << "# Superslave zone '" << domain.toString() << "' (added: " << nowTime() << ") (account: " << account << ')' << endl; + c_of << "# AutoSecondary zone '" << domain.toString() << "' (added: " << nowTime() << ") (account: " << account << ')' << endl; c_of << "zone \"" << domain.toStringNoDot() << "\" {" << endl; c_of << "\ttype secondary;" << endl; c_of << "\tfile \"" << filename << "\";" << endl; @@ -1441,7 +1441,7 @@ bool Bind2Backend::createSlaveDomain(const string& ip, const DNSName& domain, co } BB2DomainInfo bbd = createDomainEntry(domain, filename); - bbd.d_kind = DomainInfo::Slave; + bbd.d_kind = DomainInfo::Secondary; bbd.d_primaries.push_back(ComboAddress(ip, 53)); bbd.setCtime(); safePutBBDomainInfo(bbd); @@ -1503,7 +1503,7 @@ public: declare(suffix, "check-interval", "Interval for zonefile changes", "0"); declare(suffix, "autoprimary-config", "Location of (part of) named.conf where pdns can write zone-statements to", ""); declare(suffix, "autoprimaries", "List of IP-addresses of autoprimaries", ""); - declare(suffix, "autoprimary-destdir", "Destination directory for newly added slave zones", ::arg()["config-dir"]); + declare(suffix, "autoprimary-destdir", "Destination directory for newly added secondary zones", ::arg()["config-dir"]); declare(suffix, "dnssec-db", "Filename to store & access our DNSSEC metadatabase, empty for none", ""); declare(suffix, "dnssec-db-journal-mode", "SQLite3 journal mode", "WAL"); declare(suffix, "hybrid", "Store DNSSEC metadata in other backend", "no"); diff --git a/modules/bindbackend/bindbackend2.hh b/modules/bindbackend/bindbackend2.hh index 01438fa6b6..b612022677 100644 --- a/modules/bindbackend/bindbackend2.hh +++ b/modules/bindbackend/bindbackend2.hh @@ -158,7 +158,7 @@ public: LookButDontTouch d_records; //!< the actual records belonging to this domain time_t d_ctime{0}; //!< last known ctime of the file on disk time_t d_lastcheck{0}; //!< last time domain was checked for freshness - uint32_t d_lastnotified{0}; //!< Last serial number we notified our slaves of + uint32_t d_lastnotified{0}; //!< Last serial number we notified our secondaries of unsigned int d_id{0}; //!< internal id of the domain mutable bool d_checknow; //!< if this domain has been flagged for a check bool d_loaded{false}; //!< if a domain is loaded @@ -183,7 +183,7 @@ class Bind2Backend : public DNSBackend public: Bind2Backend(const string& suffix = "", bool loadZones = true); ~Bind2Backend(); - void getUnfreshSlaveInfos(vector* unfreshDomains) override; + void getUnfreshSecondaryInfos(vector* unfreshDomains) override; void getUpdatedPrimaries(vector& changedDomains, std::unordered_set& catalogs, CatalogHashMap& catalogHashes) override; bool getDomainInfo(const DNSName& domain, DomainInfo& di, bool getSerial = true) override; time_t getCtime(const string& fname); @@ -237,8 +237,8 @@ public: // for autoprimary support bool autoPrimariesList(std::vector& primaries) override; bool autoPrimaryBackend(const string& ip, const DNSName& domain, const vector& nsset, string* nameserver, string* account, DNSBackend** db) override; - static std::mutex s_autoprimary_config_lock; - bool createSlaveDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account) override; + static std::mutex s_autosecondary_config_lock; + bool createSecondaryDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account) override; private: void setupDNSSEC(); diff --git a/modules/gmysqlbackend/gmysqlbackend.cc b/modules/gmysqlbackend/gmysqlbackend.cc index 1dff26d567..cd3d62595d 100644 --- a/modules/gmysqlbackend/gmysqlbackend.cc +++ b/modules/gmysqlbackend/gmysqlbackend.cc @@ -103,7 +103,7 @@ public: declare(suffix, "info-zone-query", "", "select id,name,master,last_check,notified_serial,type,options,catalog,account from domains where name=?"); - declare(suffix, "info-all-slaves-query", "", "select domains.id, domains.name, domains.type, domains.master, domains.last_check, records.content from domains LEFT JOIN records ON records.domain_id=domains.id AND records.type='SOA' AND records.name=domains.name where domains.type in ('SLAVE', 'CONSUMER')"); + declare(suffix, "info-all-secondaries-query", "", "select domains.id, domains.name, domains.type, domains.master, domains.last_check, records.content from domains LEFT JOIN records ON records.domain_id=domains.id AND records.type='SOA' AND records.name=domains.name where domains.type in ('SLAVE', 'CONSUMER')"); declare(suffix, "autoprimary-query", "", "select account from supermasters where ip=? and nameserver=?"); declare(suffix, "autoprimary-name-to-ips", "", "select ip,account from supermasters where nameserver=? and account=?"); declare(suffix, "autoprimary-add", "", "insert into supermasters (ip, nameserver, account) values (?,?,?)"); diff --git a/modules/godbcbackend/godbcbackend.cc b/modules/godbcbackend/godbcbackend.cc index 67276dbd96..f34e8beb11 100644 --- a/modules/godbcbackend/godbcbackend.cc +++ b/modules/godbcbackend/godbcbackend.cc @@ -83,7 +83,7 @@ public: declare(suffix, "info-zone-query", "", "select id,name,master,last_check,notified_serial,type,options,catalog,account from domains where name=?"); - declare(suffix, "info-all-slaves-query", "", "select domains.id, domains.name, domains.type, domains.master, domains.last_check, records.content from domains LEFT JOIN records ON records.domain_id=domains.id AND records.type='SOA' AND records.name=domains.name where domains.type in ('SLAVE', 'CONSUMER')"); + declare(suffix, "info-all-secondaries-query", "", "select domains.id, domains.name, domains.type, domains.master, domains.last_check, records.content from domains LEFT JOIN records ON records.domain_id=domains.id AND records.type='SOA' AND records.name=domains.name where domains.type in ('SLAVE', 'CONSUMER')"); declare(suffix, "autoprimary-query", "", "select account from supermasters where ip=? and nameserver=?"); declare(suffix, "autoprimary-name-to-ips", "", "select ip,account from supermasters where nameserver=? and account=?"); declare(suffix, "autoprimary-add", "", "insert into supermasters (ip, nameserver, account) values (?,?,?)"); diff --git a/modules/gpgsqlbackend/gpgsqlbackend.cc b/modules/gpgsqlbackend/gpgsqlbackend.cc index 89f8d6e4c2..c343855b16 100644 --- a/modules/gpgsqlbackend/gpgsqlbackend.cc +++ b/modules/gpgsqlbackend/gpgsqlbackend.cc @@ -110,7 +110,7 @@ public: declare(suffix, "info-zone-query", "", "select id,name,master,last_check,notified_serial,type,options,catalog,account from domains where name=$1"); - declare(suffix, "info-all-slaves-query", "", "select domains.id, domains.name, domains.type, domains.master, domains.last_check, records.content from domains LEFT JOIN records ON records.domain_id=domains.id AND records.type='SOA' AND records.name=domains.name where domains.type in ('SLAVE', 'CONSUMER')"); + declare(suffix, "info-all-secondaries-query", "", "select domains.id, domains.name, domains.type, domains.master, domains.last_check, records.content from domains LEFT JOIN records ON records.domain_id=domains.id AND records.type='SOA' AND records.name=domains.name where domains.type in ('SLAVE', 'CONSUMER')"); declare(suffix, "autoprimary-query", "", "select account from supermasters where ip=$1 and nameserver=$2"); declare(suffix, "autoprimary-name-to-ips", "", "select ip,account from supermasters where nameserver=$1 and account=$2"); declare(suffix, "autoprimary-add", "", "insert into supermasters (ip, nameserver, account) values ($1,$2,$3)"); diff --git a/modules/gsqlite3backend/gsqlite3backend.cc b/modules/gsqlite3backend/gsqlite3backend.cc index a9f3aa6e37..b67f4f0e59 100644 --- a/modules/gsqlite3backend/gsqlite3backend.cc +++ b/modules/gsqlite3backend/gsqlite3backend.cc @@ -96,7 +96,7 @@ public: declare(suffix, "info-zone-query", "", "select id,name,master,last_check,notified_serial,type,options,catalog,account from domains where name=:domain"); - declare(suffix, "info-all-slaves-query", "", "select domains.id, domains.name, domains.type, domains.master, domains.last_check, records.content from domains LEFT JOIN records ON records.domain_id=domains.id AND records.type='SOA' AND records.name=domains.name where domains.type in ('SLAVE', 'CONSUMER')"); + declare(suffix, "info-all-secondaries-query", "", "select domains.id, domains.name, domains.type, domains.master, domains.last_check, records.content from domains LEFT JOIN records ON records.domain_id=domains.id AND records.type='SOA' AND records.name=domains.name where domains.type in ('SLAVE', 'CONSUMER')"); declare(suffix, "autoprimary-query", "", "select account from supermasters where ip=:ip and nameserver=:nameserver"); declare(suffix, "autoprimary-name-to-ips", "", "select ip,account from supermasters where nameserver=:nameserver and account=:account"); declare(suffix, "autoprimary-add", "", "insert into supermasters (ip, nameserver, account) values (:ip,:nameserver,:account)"); diff --git a/modules/ldapbackend/native.cc b/modules/ldapbackend/native.cc index 963dd7338f..48421ea99c 100644 --- a/modules/ldapbackend/native.cc +++ b/modules/ldapbackend/native.cc @@ -391,7 +391,7 @@ bool LdapBackend::getDomainInfo(const DNSName& domain, DomainInfo& di, bool /* g if (kind == "master") di.kind = DomainInfo::Primary; else if (kind == "slave") - di.kind = DomainInfo::Slave; + di.kind = DomainInfo::Secondary; else di.kind = DomainInfo::Native; } diff --git a/modules/lmdbbackend/lmdbbackend.cc b/modules/lmdbbackend/lmdbbackend.cc index b9f17d62d8..3cfbf8c4da 100644 --- a/modules/lmdbbackend/lmdbbackend.cc +++ b/modules/lmdbbackend/lmdbbackend.cc @@ -1754,7 +1754,7 @@ void LMDBBackend::getAllDomains(vector* domains, bool /* doSerial */ }); } -void LMDBBackend::getUnfreshSlaveInfos(vector* domains) +void LMDBBackend::getUnfreshSecondaryInfos(vector* domains) { uint32_t serial; time_t now = time(0); @@ -1848,7 +1848,7 @@ bool LMDBBackend::getCatalogMembers(const DNSName& catalog, vector& try { getAllDomainsFiltered(&scratch, [&catalog, &members, &type](DomainInfo& di) { - if ((type == CatalogInfo::CatalogType::Producer && di.kind != DomainInfo::Primary) || (type == CatalogInfo::CatalogType::Consumer && di.kind != DomainInfo::Slave) || di.catalog != catalog) { + if ((type == CatalogInfo::CatalogType::Producer && di.kind != DomainInfo::Primary) || (type == CatalogInfo::CatalogType::Consumer && di.kind != DomainInfo::Secondary) || di.catalog != catalog) { return false; } diff --git a/modules/lmdbbackend/lmdbbackend.hh b/modules/lmdbbackend/lmdbbackend.hh index f7e3d8a6b2..e75b564c55 100644 --- a/modules/lmdbbackend/lmdbbackend.hh +++ b/modules/lmdbbackend/lmdbbackend.hh @@ -82,7 +82,7 @@ public: bool get(DNSZoneRecord& dzr) override; // secondary support - void getUnfreshSlaveInfos(vector* domains) override; + void getUnfreshSecondaryInfos(vector* domains) override; void setStale(uint32_t domain_id) override; void setFresh(uint32_t domain_id) override; diff --git a/modules/remotebackend/remotebackend.cc b/modules/remotebackend/remotebackend.cc index 75b8bbd5fe..2cb6d5f930 100644 --- a/modules/remotebackend/remotebackend.cc +++ b/modules/remotebackend/remotebackend.cc @@ -608,7 +608,7 @@ void RemoteBackend::parseDomainInfo(const Json& obj, DomainInfo& di) di.kind = DomainInfo::Primary; } else if (kind == "slave") { - di.kind = DomainInfo::Slave; + di.kind = DomainInfo::Secondary; } else { di.kind = DomainInfo::Native; @@ -684,7 +684,7 @@ bool RemoteBackend::autoPrimaryBackend(const string& ip, const DNSName& domain, return true; } -bool RemoteBackend::createSlaveDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account) +bool RemoteBackend::createSecondaryDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account) { Json query = Json::object{ {"method", "createSlaveDomain"}, @@ -923,7 +923,7 @@ void RemoteBackend::getUpdatedPrimaries(vector& domains, std::unorde } } -void RemoteBackend::getUnfreshSlaveInfos(vector* domains) +void RemoteBackend::getUnfreshSecondaryInfos(vector* domains) { Json query = Json::object{ {"method", "getUnfreshSlaveInfos"}, diff --git a/modules/remotebackend/remotebackend.hh b/modules/remotebackend/remotebackend.hh index a4399ee890..a435465173 100644 --- a/modules/remotebackend/remotebackend.hh +++ b/modules/remotebackend/remotebackend.hh @@ -187,7 +187,7 @@ public: void setNotified(uint32_t id, uint32_t serial) override; bool doesDNSSEC() override; bool autoPrimaryBackend(const string& ip, const DNSName& domain, const vector& nsset, string* nameserver, string* account, DNSBackend** ddb) override; - bool createSlaveDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account) override; + bool createSecondaryDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account) override; bool replaceRRSet(uint32_t domain_id, const DNSName& qname, const QType& qt, const vector& rrset) override; bool feedRecord(const DNSResourceRecord& r, const DNSName& ordername, bool ordernameIsNSEC3 = false) override; bool feedEnts(int domain_id, map& nonterm) override; @@ -203,7 +203,7 @@ public: bool searchComments(const string& pattern, size_t maxResults, vector& result) override; void getAllDomains(vector* domains, bool getSerial, bool include_disabled) override; void getUpdatedPrimaries(vector& domains, std::unordered_set& catalogs, CatalogHashMap& catalogHashes) override; - void getUnfreshSlaveInfos(vector* domains) override; + void getUnfreshSecondaryInfos(vector* domains) override; void setStale(uint32_t domain_id) override; void setFresh(uint32_t domain_id) override; diff --git a/modules/remotebackend/test-remotebackend.cc b/modules/remotebackend/test-remotebackend.cc index 9dfd61dfe8..566390aa91 100644 --- a/modules/remotebackend/test-remotebackend.cc +++ b/modules/remotebackend/test-remotebackend.cc @@ -298,10 +298,10 @@ BOOST_AUTO_TEST_CASE(test_method_autoPrimaryBackend) BOOST_CHECK_EQUAL(dbd, backendUnderTest.get()); } -BOOST_AUTO_TEST_CASE(test_method_createSlaveDomain) +BOOST_AUTO_TEST_CASE(test_method_createSecondaryDomain) { - BOOST_TEST_MESSAGE("Testing createSlaveDomain method"); - BOOST_CHECK(backendUnderTest->createSlaveDomain("10.0.0.1", DNSName("pirate.unit.test."), "", "")); + BOOST_TEST_MESSAGE("Testing createSecondaryDomain method"); + BOOST_CHECK(backendUnderTest->createSecondaryDomain("10.0.0.1", DNSName("pirate.unit.test."), "", "")); } BOOST_AUTO_TEST_CASE(test_method_feedRecord) diff --git a/modules/tinydnsbackend/tinydnsbackend.cc b/modules/tinydnsbackend/tinydnsbackend.cc index 251696a422..6ba897fb48 100644 --- a/modules/tinydnsbackend/tinydnsbackend.cc +++ b/modules/tinydnsbackend/tinydnsbackend.cc @@ -374,7 +374,7 @@ public: void declareArguments(const string& suffix = "") override { - declare(suffix, "notify-on-startup", "Tell the TinyDNSBackend to notify all the slave nameservers on startup. Default is no.", "no"); + declare(suffix, "notify-on-startup", "Tell the TinyDNSBackend to notify all the secondary nameservers on startup. Default is no.", "no"); declare(suffix, "dbfile", "Location of the cdb data file", "data.cdb"); declare(suffix, "tai-adjust", "This adjusts the TAI value if timestamps are used. These seconds will be added to the start point (1970) and will allow you to adjust for leap seconds. The default is 11.", "11"); declare(suffix, "locations", "Enable or Disable location support in the backend. Changing the value to 'no' will make the backend ignore the locations. This then returns all records!", "yes"); diff --git a/pdns/auth-main.cc b/pdns/auth-main.cc index 9d11c497c6..e148cb8735 100644 --- a/pdns/auth-main.cc +++ b/pdns/auth-main.cc @@ -167,7 +167,7 @@ static void declareArguments() ::arg().set("allow-unsigned-notify", "Allow unsigned notifications for TSIG secured zones") = "yes"; // FIXME: change to 'no' later ::arg().set("allow-unsigned-supermaster", "Allow supermasters to create zones without TSIG signed NOTIFY") = "yes"; ::arg().set("allow-unsigned-autoprimary", "Allow autoprimaries to create zones without TSIG signed NOTIFY") = "yes"; - ::arg().setSwitch("forward-dnsupdate", "A global setting to allow DNS update packages that are for a Slave zone, to be forwarded to the primary.") = "yes"; + ::arg().setSwitch("forward-dnsupdate", "A global setting to allow DNS update packages that are for a Secondary zone, to be forwarded to the primary.") = "yes"; ::arg().setSwitch("log-dns-details", "If PDNS should log DNS non-erroneous details") = "no"; ::arg().setSwitch("log-dns-queries", "If PDNS should log all incoming DNS queries") = "no"; ::arg().set("local-address", "Local IP addresses to which we bind") = "0.0.0.0, ::"; @@ -178,7 +178,7 @@ static void declareArguments() ::arg().set("overload-queue-length", "Maximum queuelength moving to packetcache only") = "0"; ::arg().set("max-queue-length", "Maximum queuelength before considering situation lost") = "5000"; - ::arg().set("retrieval-threads", "Number of AXFR-retrieval threads for slave operation") = "2"; + ::arg().set("retrieval-threads", "Number of AXFR-retrieval threads for secondary operation") = "2"; ::arg().setSwitch("api", "Enable/disable the REST API (including HTTP listener)") = "no"; ::arg().set("api-key", "Static pre-shared authentication key for access to the REST API") = ""; ::arg().setSwitch("default-api-rectify", "Default API-RECTIFY value for zones") = "yes"; @@ -212,7 +212,7 @@ static void declareArguments() ::arg().set("only-notify", "Only send AXFR NOTIFY to these IP addresses or netmasks") = "0.0.0.0/0,::/0"; ::arg().set("also-notify", "When notifying a zone, also notify these nameservers") = ""; ::arg().set("allow-notify-from", "Allow AXFR NOTIFY from these IP ranges. If empty, drop all incoming notifies.") = "0.0.0.0/0,::/0"; - ::arg().set("slave-cycle-interval", "Schedule slave freshness checks once every .. seconds") = ""; + ::arg().set("slave-cycle-interval", "Schedule secondary freshness checks once every .. seconds") = ""; ::arg().set("xfr-cycle-interval", "Schedule primary/secondary SOA freshness checks once every .. seconds") = "60"; ::arg().set("secondary-check-signature-freshness", "Check signatures in SOA freshness check. Sets DO flag on SOA queries. Outside some very problematic scenarios, say yes here.") = "yes"; @@ -268,7 +268,7 @@ static void declareArguments() ::arg().set("trusted-notification-proxy", "IP address of incoming notification proxy") = ""; ::arg().set("slave-renotify", "If we should send out notifications for secondaried updates") = "no"; ::arg().set("secondary-do-renotify", "If this secondary should send out notifications after receiving zone transfers from a primary") = "no"; - ::arg().set("forward-notify", "IP addresses to forward received notifications to regardless of primary or slave settings") = ""; + ::arg().set("forward-notify", "IP addresses to forward received notifications to regardless of primary or secondary settings") = ""; ::arg().set("default-ttl", "Seconds a result is valid if not set otherwise") = "3600"; ::arg().set("max-tcp-connections", "Maximum number of TCP connections") = "20"; @@ -1437,7 +1437,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 zone", " []"); + DynListener::registerFunc("RETRIEVE", &DLNotifyRetrieveHandler, "retrieve secondary zone", " []"); DynListener::registerFunc("CURRENT-CONFIG", &DLCurrentConfigHandler, "retrieve the current configuration", "[diff]"); DynListener::registerFunc("LIST-ZONES", &DLListZones, "show list of zones", "[primary|secondary|native|consumer|producer]"); DynListener::registerFunc("TOKEN-LOGIN", &DLTokenLogin, "Login to a PKCS#11 token", " "); diff --git a/pdns/backends/gsql/gsqlbackend.cc b/pdns/backends/gsql/gsqlbackend.cc index f137c3621e..d3351d16dd 100644 --- a/pdns/backends/gsql/gsqlbackend.cc +++ b/pdns/backends/gsql/gsqlbackend.cc @@ -67,7 +67,7 @@ GSQLBackend::GSQLBackend(const string &mode, const string &suffix) d_listSubZoneQuery=getArg("list-subzone-query"); d_InfoOfDomainsZoneQuery=getArg("info-zone-query"); - d_InfoOfAllSlaveDomainsQuery=getArg("info-all-slaves-query"); + d_InfoOfAllSecondaryDomainsQuery = getArg("info-all-secondaries-query"); d_AutoPrimaryInfoQuery = getArg("autoprimary-query"); d_GetAutoPrimaryIPs = getArg("autoprimary-name-to-ips"); d_AddAutoPrimary = getArg("autoprimary-add"); @@ -143,7 +143,7 @@ GSQLBackend::GSQLBackend(const string &mode, const string &suffix) d_listQuery_stmt = nullptr; d_listSubZoneQuery_stmt = nullptr; d_InfoOfDomainsZoneQuery_stmt = nullptr; - d_InfoOfAllSlaveDomainsQuery_stmt = nullptr; + d_InfoOfAllSecondaryDomainsQuery_stmt = nullptr; d_AutoPrimaryInfoQuery_stmt = nullptr; d_GetAutoPrimaryIPs_stmt = nullptr; d_AddAutoPrimary_stmt = nullptr; @@ -413,7 +413,7 @@ bool GSQLBackend::getDomainInfo(const DNSName &domain, DomainInfo &di, bool getS return true; } -void GSQLBackend::getUnfreshSlaveInfos(vector *unfreshDomains) +void GSQLBackend::getUnfreshSecondaryInfos(vector* unfreshDomains) { /* list all domains that need refreshing for which we are secondary, and insert into @@ -424,14 +424,14 @@ void GSQLBackend::getUnfreshSlaveInfos(vector *unfreshDomains) reconnectIfNeeded(); // clang-format off - d_InfoOfAllSlaveDomainsQuery_stmt-> + d_InfoOfAllSecondaryDomainsQuery_stmt-> execute()-> getResult(d_result)-> reset(); // clang-format on } catch (SSqlException &e) { - throw PDNSException(std::string(__PRETTY_FUNCTION__) + " unable to retrieve list of slave domains: " + e.txtReason()); + throw PDNSException(std::string(__PRETTY_FUNCTION__) + " unable to retrieve list of secondary domains: " + e.txtReason()); } SOAData sd; @@ -440,7 +440,7 @@ void GSQLBackend::getUnfreshSlaveInfos(vector *unfreshDomains) unfreshDomains->reserve(d_result.size()); for (const auto& row : d_result) { // id, name, type, master, last_check, catalog, content - ASSERT_ROW_COLUMNS("info-all-slaves-query", row, 6); + ASSERT_ROW_COLUMNS("info-all-secondaries-query", row, 6); try { di.zone = DNSName(row[1]); @@ -505,7 +505,7 @@ void GSQLBackend::getUnfreshSlaveInfos(vector *unfreshDomains) } if (pdns_iequals(row[2], "SLAVE")) { - di.kind = DomainInfo::Slave; + di.kind = DomainInfo::Secondary; } else if (pdns_iequals(row[2], "CONSUMER")) { di.kind = DomainInfo::Consumer; @@ -1658,7 +1658,7 @@ bool GSQLBackend::createDomain(const DNSName& domain, const DomainInfo::DomainKi return true; } -bool GSQLBackend::createSlaveDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account) +bool GSQLBackend::createSecondaryDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account) { string name; vector primaries({ComboAddress(ip, 53)}); @@ -1686,10 +1686,10 @@ bool GSQLBackend::createSlaveDomain(const string& ip, const DNSName& domain, con primaries = tmp; } } - createDomain(domain, DomainInfo::Slave, primaries, account); + createDomain(domain, DomainInfo::Secondary, primaries, account); } catch(SSqlException &e) { - throw PDNSException("Database error trying to insert new slave domain '"+domain.toLogString()+"': "+ e.txtReason()); + throw PDNSException("Database error trying to insert new secondary domain '" + domain.toLogString() + "': " + e.txtReason()); } return true; } @@ -1765,7 +1765,7 @@ void GSQLBackend::getAllDomains(vector* domains, bool getSerial, boo if (pdns_iequals(row[3], "MASTER")) { di.kind = DomainInfo::Primary; } else if (pdns_iequals(row[3], "SLAVE")) { - di.kind = DomainInfo::Slave; + di.kind = DomainInfo::Secondary; } else if (pdns_iequals(row[3], "NATIVE")) { di.kind = DomainInfo::Native; } diff --git a/pdns/backends/gsql/gsqlbackend.hh b/pdns/backends/gsql/gsqlbackend.hh index ef23dd7537..51f1da599e 100644 --- a/pdns/backends/gsql/gsqlbackend.hh +++ b/pdns/backends/gsql/gsqlbackend.hh @@ -63,7 +63,7 @@ protected: d_listSubZoneQuery_stmt = d_db->prepare(d_listSubZoneQuery, 3); d_PrimaryOfDomainsZoneQuery_stmt = d_db->prepare(d_PrimaryOfDomainsZoneQuery, 1); d_InfoOfDomainsZoneQuery_stmt = d_db->prepare(d_InfoOfDomainsZoneQuery, 1); - d_InfoOfAllSlaveDomainsQuery_stmt = d_db->prepare(d_InfoOfAllSlaveDomainsQuery, 0); + d_InfoOfAllSecondaryDomainsQuery_stmt = d_db->prepare(d_InfoOfAllSecondaryDomainsQuery, 0); d_AutoPrimaryInfoQuery_stmt = d_db->prepare(d_AutoPrimaryInfoQuery, 2); d_GetAutoPrimaryIPs_stmt = d_db->prepare(d_GetAutoPrimaryIPs, 2); d_AddAutoPrimary_stmt = d_db->prepare(d_AddAutoPrimary, 3); @@ -133,7 +133,7 @@ protected: d_listSubZoneQuery_stmt.reset(); d_PrimaryOfDomainsZoneQuery_stmt.reset(); d_InfoOfDomainsZoneQuery_stmt.reset(); - d_InfoOfAllSlaveDomainsQuery_stmt.reset(); + d_InfoOfAllSecondaryDomainsQuery_stmt.reset(); d_AutoPrimaryInfoQuery_stmt.reset(); d_GetAutoPrimaryIPs_stmt.reset(); d_AddAutoPrimary_stmt.reset(); @@ -205,7 +205,7 @@ public: bool feedEnts(int domain_id, map& nonterm) override; bool feedEnts3(int domain_id, const DNSName &domain, map &nonterm, const NSEC3PARAMRecordContent& ns3prc, bool narrow) override; bool createDomain(const DNSName& domain, const DomainInfo::DomainKind kind, const vector& primaries, const string& account) override; - bool createSlaveDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account) override; + bool createSecondaryDomain(const string& ip, const DNSName& domain, const string& nameserver, const string& account) override; bool deleteDomain(const DNSName &domain) override; bool autoPrimaryAdd(const AutoPrimary& primary) override; bool autoPrimaryRemove(const AutoPrimary& primary) override; @@ -213,7 +213,7 @@ public: bool autoPrimaryBackend(const string& ip, const DNSName& domain, const vector& nsset, string* nameserver, string* account, DNSBackend** db) override; void setStale(uint32_t domain_id) override; void setFresh(uint32_t domain_id) override; - void getUnfreshSlaveInfos(vector *domains) override; + void getUnfreshSecondaryInfos(vector* domains) override; void getUpdatedPrimaries(vector& updatedDomains, std::unordered_set& catalogs, CatalogHashMap& catalogHashes) override; bool getCatalogMembers(const DNSName& catalog, vector& members, CatalogInfo::CatalogType type) override; bool getDomainInfo(const DNSName &domain, DomainInfo &di, bool getSerial=true) override; @@ -300,7 +300,7 @@ private: string d_PrimaryOfDomainsZoneQuery; string d_InfoOfDomainsZoneQuery; - string d_InfoOfAllSlaveDomainsQuery; + string d_InfoOfAllSecondaryDomainsQuery; string d_AutoPrimaryInfoQuery; string d_GetAutoPrimaryName; string d_GetAutoPrimaryIPs; @@ -379,7 +379,7 @@ private: unique_ptr d_listSubZoneQuery_stmt; unique_ptr d_PrimaryOfDomainsZoneQuery_stmt; unique_ptr d_InfoOfDomainsZoneQuery_stmt; - unique_ptr d_InfoOfAllSlaveDomainsQuery_stmt; + unique_ptr d_InfoOfAllSecondaryDomainsQuery_stmt; unique_ptr d_AutoPrimaryInfoQuery_stmt; unique_ptr d_GetAutoPrimaryIPs_stmt; unique_ptr d_AddAutoPrimary_stmt; diff --git a/pdns/communicator.cc b/pdns/communicator.cc index 80f65f31c0..20cadfd7bf 100644 --- a/pdns/communicator.cc +++ b/pdns/communicator.cc @@ -129,7 +129,7 @@ void CommunicatorClass::mainloop() makeNotifySockets(); for(;;) { - slaveRefresh(&P); + secondaryRefresh(&P); primaryUpdateCheck(&P); doNotifications(&P); // this processes any notification acknowledgements and actually send out our own notifications @@ -139,16 +139,16 @@ void CommunicatorClass::mainloop() rc=d_any_sem.tryWait(); if(rc) { - bool extraSlaveRefresh = false; + bool extraSecondaryRefresh = false; Utility::sleep(1); { auto data = d_data.lock(); if (data->d_tocheck.size()) { - extraSlaveRefresh = true; + extraSecondaryRefresh = true; } } - if (extraSlaveRefresh) - slaveRefresh(&P); + if (extraSecondaryRefresh) + secondaryRefresh(&P); } else { // eat up extra posts to avoid busy looping if many posts were done diff --git a/pdns/communicator.hh b/pdns/communicator.hh index e913eea1f2..20ac6c5723 100644 --- a/pdns/communicator.hh +++ b/pdns/communicator.hh @@ -150,7 +150,7 @@ public: CommunicatorClass() { d_tickinterval=60; - d_slaveschanged = true; + d_secondarieschanged = true; d_nsock4 = -1; d_nsock6 = -1; d_preventSelfNotification = false; @@ -162,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& primary, SuckRequest::RequestPriority, bool force = false); - void addSlaveCheckRequest(const DomainInfo& di, const ComboAddress& remote); + void addSecondaryCheckRequest(const DomainInfo& di, const ComboAddress& remote); void addTryAutoPrimaryRequest(const DNSPacket& p); void notify(const DNSName &domain, const string &ip); void mainloop(); @@ -181,7 +181,7 @@ private: 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, ZoneStatus& zs, vector* axfr); - void slaveRefresh(PacketHandler *P); + void secondaryRefresh(PacketHandler* P); void primaryUpdateCheck(PacketHandler* P); void getUpdatedProducers(UeberBackend* B, vector& domains, const std::unordered_set& catalogs, CatalogHashMap& catalogHashes); @@ -193,7 +193,7 @@ private: NotificationQueue d_nq; time_t d_tickinterval; - bool d_slaveschanged; + bool d_secondarieschanged; bool d_preventSelfNotification; struct Data @@ -214,7 +214,7 @@ private: // Used to keep some state on domains that failed their freshness checks. // uint64_t == counter of the number of failures (increased by 1 every consecutive slave-cycle-interval that the domain fails) // time_t == wait at least until this time before attempting a new check - map > d_failedSlaveRefresh; + map> d_failedSecondaryRefresh; }; LockGuarded d_data; diff --git a/pdns/dnsbackend.hh b/pdns/dnsbackend.hh index 3593b211d0..a2ee00b41c 100644 --- a/pdns/dnsbackend.hh +++ b/pdns/dnsbackend.hh @@ -77,7 +77,7 @@ struct DomainInfo enum DomainKind : uint8_t { Primary, - Slave, + Secondary, Native, Producer, Consumer, @@ -98,7 +98,7 @@ struct DomainInfo static DomainKind stringToKind(const string& kind) { if (pdns_iequals(kind, "SECONDARY") || pdns_iequals(kind, "SLAVE")) { - return DomainInfo::Slave; + return DomainInfo::Secondary; } if (pdns_iequals(kind, "PRIMARY") || pdns_iequals(kind, "MASTER")) { return DomainInfo::Primary; @@ -114,7 +114,7 @@ struct DomainInfo } [[nodiscard]] bool isPrimaryType() const { return (kind == DomainInfo::Primary || kind == DomainInfo::Producer); } - [[nodiscard]] bool isSecondaryType() const { return (kind == DomainInfo::Slave || kind == DomainInfo::Consumer); } + [[nodiscard]] bool isSecondaryType() const { return (kind == DomainInfo::Secondary || kind == DomainInfo::Consumer); } [[nodiscard]] bool isCatalogType() const { return (kind == DomainInfo::Producer || kind == DomainInfo::Consumer); } [[nodiscard]] bool isPrimary(const ComboAddress& ipAddress) const @@ -330,8 +330,8 @@ public: { return false; } - //! slave capable backends should return a list of slaves that should be rechecked for staleness - virtual void getUnfreshSlaveInfos(vector* /* domains */) + //! secondary capable backends should return a list of secondaries that should be rechecked for staleness + virtual void getUnfreshSecondaryInfos(vector* /* domains */) { } @@ -343,7 +343,7 @@ public: ips->insert(meta.begin(), meta.end()); } - //! get list of domains that have been changed since their last notification to slaves + //! get list of domains that have been changed since their last notification to secondaries virtual void getUpdatedPrimaries(vector& /* domains */, std::unordered_set& /* catalogs */, CatalogHashMap& /* catalogHashes */) { } @@ -364,7 +364,7 @@ public: { } - //! Called by PowerDNS to inform a backend that the changes in the domain have been reported to slaves + //! Called by PowerDNS to inform a backend that the changes in the domain have been reported to secondaries virtual void setNotified(uint32_t /* id */, uint32_t /* serial */) { } @@ -432,8 +432,8 @@ public: return false; } - //! called by PowerDNS to create a slave record for a autoPrimary - virtual bool createSlaveDomain(const string& /* ip */, const DNSName& /* domain */, const string& /* nameserver */, const string& /* account */) + //! called by PowerDNS to create a secondary record for a autoPrimary + virtual bool createSecondaryDomain(const string& /* ip */, const DNSName& /* domain */, const string& /* nameserver */, const string& /* account */) { return false; } diff --git a/pdns/dnssecsigner.cc b/pdns/dnssecsigner.cc index 74dc882ab0..06ac28ce99 100644 --- a/pdns/dnssecsigner.cc +++ b/pdns/dnssecsigner.cc @@ -88,7 +88,7 @@ static void fillOutRRSIG(DNSSECPrivateKey& dpk, const DNSName& signQName, RRSIGR rrc.d_signature = rc->sign(msg); (*g_signatureCount)++; if(doCache) { - /* we add some jitter here so not all your slaves start pruning their caches at the very same millisecond */ + /* we add some jitter here so not all your secondaries start pruning their caches at the very same millisecond */ int weekno = (time(nullptr) - dns_random(3600)) / (86400*7); // we just spent milliseconds doing a signature, microsecond more won't kill us const static int maxcachesize=::arg().asNum("max-signature-cache-entries", INT_MAX); diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index f43c3df234..ff1f5bcb96 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -1043,7 +1043,7 @@ int PacketHandler::tryAutoPrimarySynchronous(const DNSPacket& p, const DNSName& return RCode::Refused; } try { - db->createSlaveDomain(remote.toString(), p.qdomain, nameserver, account); + db->createSecondaryDomain(remote.toString(), p.qdomain, nameserver, account); DomainInfo di; if (!db->getDomainInfo(p.qdomain, di, false)) { g_log << Logger::Error << "Failed to create " << p.qdomain << " for potential autoprimary " << remote << endl; @@ -1060,7 +1060,7 @@ int PacketHandler::tryAutoPrimarySynchronous(const DNSPacket& p, const DNSName& g_log << Logger::Error << "Database error trying to create " << p.qdomain << " for potential autoprimary " << remote << ": " << ae.reason << endl; return RCode::ServFail; } - g_log << Logger::Warning << "Created new slave zone '" << p.qdomain << "' from autoprimary " << remote << endl; + g_log << Logger::Warning << "Created new secondary zone '" << p.qdomain << "' from autoprimary " << remote << endl; return RCode::NoError; } @@ -1077,7 +1077,7 @@ int PacketHandler::processNotify(const DNSPacket& p) g_log<& cmds) { +static int createSecondaryZone(const vector& cmds) +{ UeberBackend B; DomainInfo di; DNSName zone(cmds.at(1)); @@ -1554,7 +1555,7 @@ static int createSlaveZone(const vector& cmds) { primaries.emplace_back(cmds.at(i), 53); } cerr << "Creating secondary zone '" << zone << "', with primaries '" << comboAddressVecToString(primaries) << "'" << endl; - B.createDomain(zone, DomainInfo::Slave, primaries, ""); + B.createDomain(zone, DomainInfo::Secondary, primaries, ""); if(!B.getDomainInfo(zone, di)) { cerr << "Zone '" << zone << "' was not created!" << endl; return EXIT_FAILURE; @@ -1562,7 +1563,7 @@ static int createSlaveZone(const vector& cmds) { return EXIT_SUCCESS; } -static int changeSlaveZonePrimary(const vector& cmds) +static int changeSecondaryZonePrimary(const vector& cmds) { UeberBackend B; DomainInfo di; @@ -2300,8 +2301,7 @@ static bool secureZone(DNSSECKeeper& dk, const DNSName& zone) return false; } - if(di.kind == DomainInfo::Slave) - { + if (di.kind == DomainInfo::Secondary) { cerr << "Warning! This is a secondary zone! If this was a mistake, please run" << endl; cerr<<"pdnsutil disable-dnssec "<createSlaveDomain("127.0.0.1", zone, "", "_testschema"); + db->createSecondaryDomain("127.0.0.1", zone, "", "_testschema"); cout << "Secondary zone created" << endl; DomainInfo di; @@ -3120,14 +3120,14 @@ try cerr << "Syntax: pdnsutil create-secondary-zone ZONE primary-ip [primary-ip..]" << endl; return 0; } - return createSlaveZone(cmds); + return createSecondaryZone(cmds); } else if (cmds.at(0) == "change-secondary-zone-primary" || cmds.at(0) == "change-slave-zone-master") { if(cmds.size() < 3 ) { cerr << "Syntax: pdnsutil change-secondary-zone-primary ZONE primary-ip [primary-ip..]" << endl; return 0; } - return changeSlaveZonePrimary(cmds); + return changeSecondaryZonePrimary(cmds); } else if (cmds.at(0) == "add-record") { if(cmds.size() < 5) { diff --git a/pdns/rfc2136handler.cc b/pdns/rfc2136handler.cc index 1c2b9c42a2..0144456b29 100644 --- a/pdns/rfc2136handler.cc +++ b/pdns/rfc2136handler.cc @@ -759,7 +759,7 @@ int PacketHandler::processUpdate(DNSPacket& p) { return RCode::NotAuth; } - if (di.kind == DomainInfo::Slave) + if (di.kind == DomainInfo::Secondary) return forwardPacket(msgPrefix, p, di); // Check if all the records provided are within the zone @@ -989,7 +989,7 @@ int PacketHandler::processUpdate(DNSPacket& p) { zone.append("$"); purgeAuthCaches(zone); - // Notify slaves + // Notify secondaries if (di.kind == DomainInfo::Primary) { vector notify; B.getDomainMetadata(p.qdomain, "NOTIFY-DNSUPDATE", notify); diff --git a/pdns/slavecommunicator.cc b/pdns/slavecommunicator.cc index 6518f3335e..c2d9a58fc7 100644 --- a/pdns/slavecommunicator.cc +++ b/pdns/slavecommunicator.cc @@ -237,7 +237,7 @@ static bool catalogDiff(const DomainInfo& di, vector& fromXFR, vect } g_log << Logger::Warning << logPrefix << "create zone '" << ciCreate.d_zone << "'" << endl; - di.backend->createDomain(ciCreate.d_zone, DomainInfo::Slave, ciCreate.d_primaries, ""); + di.backend->createDomain(ciCreate.d_zone, DomainInfo::Secondary, ciCreate.d_primaries, ""); di.backend->setPrimaries(ciCreate.d_zone, di.primaries); di.backend->setOptions(ciCreate.d_zone, ciCreate.toJson()); @@ -435,9 +435,9 @@ void CommunicatorClass::ixfrSuck(const DNSName& domain, const TSIGTriplet& tt, c bool wrongDomainKind = false; // this checks three error conditions, and sets wrongDomainKind if we hit the third & had an error - 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, di.kind != DomainInfo::Secondary)) { // di.backend and B are mostly identical if(wrongDomainKind) - g_log< meta; if(B.getDomainMetadata(domain, "SLAVE-RENOTIFY", meta ) && !meta.empty()) { @@ -992,16 +992,16 @@ void CommunicatorClass::suck(const DNSName &domain, const ComboAddress& remote, auto data = d_data.lock(); // The AXFR probably failed due to a problem on the primary server. If SOA-checks against this primary // still succeed, we would constantly try to AXFR the zone. To avoid this, we add the zone to the list of - // failed slave-checks. This will suspend slave-checks (and subsequent AXFR) for this zone for some time. + // failed secondary-checks. This will suspend secondary-checks (and subsequent AXFR) for this zone for some time. uint64_t newCount = 1; time_t now = time(nullptr); - const auto failedEntry = data->d_failedSlaveRefresh.find(domain); - if (failedEntry != data->d_failedSlaveRefresh.end()) { - newCount = data->d_failedSlaveRefresh[domain].first + 1; + const auto failedEntry = data->d_failedSecondaryRefresh.find(domain); + if (failedEntry != data->d_failedSecondaryRefresh.end()) { + newCount = data->d_failedSecondaryRefresh[domain].first + 1; } time_t nextCheck = now + std::min(newCount * d_tickinterval, (uint64_t)::arg().asNum("default-ttl")); - data->d_failedSlaveRefresh[domain] = {newCount, nextCheck}; - g_log<d_failedSecondaryRefresh[domain] = {newCount, nextCheck}; + g_log << Logger::Warning << logPrefix << "unable to xfr zone (ResolverException): " << re.reason << " (This was attempt number " << newCount << ". Excluding zone from secondary-checks until " << nextCheck << ")" << endl; } if(di.backend && transaction) { g_log< Identifier; @@ -1040,7 +1039,7 @@ struct SlaveSenderReceiver map d_freshness; - SlaveSenderReceiver() + SecondarySenderReceiver() { } @@ -1079,7 +1078,7 @@ struct SlaveSenderReceiver Resolver d_resolver; }; -void CommunicatorClass::addSlaveCheckRequest(const DomainInfo& di, const ComboAddress& remote) +void CommunicatorClass::addSecondaryCheckRequest(const DomainInfo& di, const ComboAddress& remote) { auto data = d_data.lock(); DomainInfo ours = di; @@ -1109,9 +1108,9 @@ void CommunicatorClass::addTryAutoPrimaryRequest(const DNSPacket& p) } } -void CommunicatorClass::slaveRefresh(PacketHandler *P) +void CommunicatorClass::secondaryRefresh(PacketHandler* P) { - // not unless we are slave + // not unless we are secondary if (!::arg().mustDo("secondary")) return; UeberBackend *B=P->getBackend(); @@ -1129,12 +1128,13 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P) } else { // We received a NOTIFY for a zone. This means at least one of the zone's primary server is working. - // Therefore we delete the zone from the list of failed slave-checks to allow immediate checking. - const auto wasFailedDomain = data->d_failedSlaveRefresh.find(di.zone); - if (wasFailedDomain != data->d_failedSlaveRefresh.end()) { - g_log<d_failedSlaveRefresh.erase(di.zone); - } else { + // Therefore we delete the zone from the list of failed secondary-checks to allow immediate checking. + const auto wasFailedDomain = data->d_failedSecondaryRefresh.find(di.zone); + if (wasFailedDomain != data->d_failedSecondaryRefresh.end()) { + g_log << Logger::Debug << "Got NOTIFY for " << di.zone << ", removing zone from list of failed secondary-checks and going to check SOA serial" << endl; + data->d_failedSecondaryRefresh.erase(di.zone); + } + else { g_log<tryAutoPrimarySynchronous(dp, tsigkeyname); // FIXME could use some error logging } if(rdomains.empty()) { // if we have priority domains, check them first - B->getUnfreshSlaveInfos(&rdomains); + B->getUnfreshSecondaryInfos(&rdomains); } sdomains.reserve(rdomains.size()); DNSSECKeeper dk(B); // NOW HEAR THIS! This DK uses our B backend, so no interleaved access! @@ -1165,8 +1165,8 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P) time_t now = time(nullptr); for(DomainInfo& di : rdomains) { - const auto failed = data->d_failedSlaveRefresh.find(di.zone); - if (failed != data->d_failedSlaveRefresh.end() && now < failed->second.second ) { + const auto failed = data->d_failedSecondaryRefresh.find(di.zone); + if (failed != data->d_failedSecondaryRefresh.end() && now < failed->second.second) { // If the domain has failed before and the time before the next check has not expired, skip this domain g_log<second.second< localaddr; SuckRequest sr; sr.domain=di.zone; - if (di.primaries.empty()) // slave domains w/o primaries are ignored + if (di.primaries.empty()) // secondary domains w/o primaries are ignored continue; // remove unfresh domains already queued for AXFR, no sense polling them again sr.primary = *di.primaries.begin(); @@ -1221,23 +1221,21 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P) } if(sdomains.empty()) { - if (d_slaveschanged) { + if (d_secondarieschanged) { auto data = d_data.lock(); - g_log<d_suckdomains.size()<<" queued for AXFR already, "<d_inprogress.size()<<" in progress"<d_suckdomains.size() << " queued for AXFR already, " << data->d_inprogress.size() << " in progress" << endl; } - d_slaveschanged = !rdomains.empty(); + d_secondarieschanged = !rdomains.empty(); return; } else { auto data = d_data.lock(); - g_log<1 ? "s" : "")<<" need"<< - (sdomains.size()>1 ? "" : "s")<< - " checking, "<d_suckdomains.size()<<" queued for AXFR"< 1 ? "s" : "") << " need" << (sdomains.size() > 1 ? "" : "s") << " checking, " << data->d_suckdomains.size() << " queued for AXFR" << endl; } - SlaveSenderReceiver ssr; + SecondarySenderReceiver ssr; - Inflighter, SlaveSenderReceiver> ifl(sdomains, ssr); + Inflighter, SecondarySenderReceiver> ifl(sdomains, ssr); ifl.d_maxInFlight = 200; @@ -1265,7 +1263,7 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P) DomainInfo& di(val.di); // If our di comes from packethandler (caused by incoming NOTIFY), di.backend will not be filled out, // and di.serial will not either. - // Conversely, if our di came from getUnfreshSlaveInfos, di.backend and di.serial are valid. + // Conversely, if our di came from getUnfreshSecondaryInfos, di.backend and di.serial are valid. if(!di.backend) { // Do not overwrite received DI just to make sure it exists in backend: // di.primaries should contain the picked primary (as first entry)! @@ -1282,11 +1280,11 @@ void CommunicatorClass::slaveRefresh(PacketHandler *P) if(!ssr.d_freshness.count(di.id)) { // If we don't have an answer for the domain uint64_t newCount = 1; auto data = d_data.lock(); - const auto failedEntry = data->d_failedSlaveRefresh.find(di.zone); - if (failedEntry != data->d_failedSlaveRefresh.end()) - newCount = data->d_failedSlaveRefresh[di.zone].first + 1; + const auto failedEntry = data->d_failedSecondaryRefresh.find(di.zone); + if (failedEntry != data->d_failedSecondaryRefresh.end()) + newCount = data->d_failedSecondaryRefresh[di.zone].first + 1; time_t nextCheck = now + std::min(newCount * d_tickinterval, (uint64_t)::arg().asNum("default-ttl")); - data->d_failedSlaveRefresh[di.zone] = {newCount, nextCheck}; + data->d_failedSecondaryRefresh[di.zone] = {newCount, nextCheck}; if (newCount == 1) { g_log<d_failedSlaveRefresh.find(di.zone); - if (wasFailedDomain != data->d_failedSlaveRefresh.end()) - data->d_failedSlaveRefresh.erase(di.zone); + const auto wasFailedDomain = data->d_failedSecondaryRefresh.find(di.zone); + if (wasFailedDomain != data->d_failedSecondaryRefresh.end()) + data->d_failedSecondaryRefresh.erase(di.zone); } bool hasSOA = false; diff --git a/pdns/ueberbackend.cc b/pdns/ueberbackend.cc index 4368d5d69a..a5981a7e7b 100644 --- a/pdns/ueberbackend.cc +++ b/pdns/ueberbackend.cc @@ -309,10 +309,10 @@ void UeberBackend::rediscover(string* status) updateZoneCache(); } -void UeberBackend::getUnfreshSlaveInfos(vector* domains) +void UeberBackend::getUnfreshSecondaryInfos(vector* domains) { for (auto& backend : backends) { - backend->getUnfreshSlaveInfos(domains); + backend->getUnfreshSecondaryInfos(domains); } } diff --git a/pdns/ueberbackend.hh b/pdns/ueberbackend.hh index b5968a2b8f..be5859c9d4 100644 --- a/pdns/ueberbackend.hh +++ b/pdns/ueberbackend.hh @@ -102,7 +102,7 @@ public: bool get(DNSZoneRecord& resourceRecord); void getAllDomains(vector* domains, bool getSerial, bool include_disabled); - void getUnfreshSlaveInfos(vector* domains); + void getUnfreshSecondaryInfos(vector* domains); void getUpdatedPrimaries(vector& domains, std::unordered_set& catalogs, CatalogHashMap& catalogHashes); bool getDomainInfo(const DNSName& domain, DomainInfo& domainInfo, bool getSerial = true); bool createDomain(const DNSName& domain, DomainInfo::DomainKind kind, const vector& primaries, const string& account); diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 4061801d3c..9612f75362 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -384,9 +384,9 @@ static void fillZone(UeberBackend& B, const DNSName& zonename, HttpResponse* res doc["api_rectify"] = (api_rectify == "1"); // TSIG - vector tsig_primary, tsig_slave; + vector tsig_primary, tsig_secondary; di.backend->getDomainMetadata(zonename, "TSIG-ALLOW-AXFR", tsig_primary); - di.backend->getDomainMetadata(zonename, "AXFR-MASTER-TSIG", tsig_slave); + di.backend->getDomainMetadata(zonename, "AXFR-MASTER-TSIG", tsig_secondary); Json::array tsig_primary_keys; for (const auto& keyname : tsig_primary) { @@ -394,11 +394,11 @@ static void fillZone(UeberBackend& B, const DNSName& zonename, HttpResponse* res } doc["master_tsig_key_ids"] = tsig_primary_keys; - Json::array tsig_slave_keys; - for (const auto& keyname : tsig_slave) { - tsig_slave_keys.push_back(apiZoneNameToId(DNSName(keyname))); + Json::array tsig_secondary_keys; + for (const auto& keyname : tsig_secondary) { + tsig_secondary_keys.push_back(apiZoneNameToId(DNSName(keyname))); } - doc["slave_tsig_key_ids"] = tsig_slave_keys; + doc["slave_tsig_key_ids"] = tsig_secondary_keys; if (shouldDoRRSets(req)) { vector records; @@ -867,7 +867,7 @@ static void updateDomainSettingsFromDocument(UeberBackend& B, DomainInfo& di, co vector metadata; extractJsonTSIGKeyIds(B, document["slave_tsig_key_ids"], metadata); if (!di.backend->setDomainMetadata(zonename, "AXFR-MASTER-TSIG", metadata)) { - throw HttpInternalServerErrorException("Unable to set new TSIG slave keys for zone '" + zonename.toLogString() + "'"); + throw HttpInternalServerErrorException("Unable to set new TSIG secondary keys for zone '" + zonename.toLogString() + "'"); } } } @@ -1731,7 +1731,7 @@ static void apiServerZonesPost(HttpRequest* req, HttpResponse* resp) { } auto nameservers = document["nameservers"]; - if (!nameservers.is_null() && !nameservers.is_array() && zonekind != DomainInfo::Slave && zonekind != DomainInfo::Consumer) { + if (!nameservers.is_null() && !nameservers.is_array() && zonekind != DomainInfo::Secondary && zonekind != DomainInfo::Consumer) { throw ApiException("Nameservers is not a list"); } @@ -1793,7 +1793,7 @@ static void apiServerZonesPost(HttpRequest* req, HttpResponse* resp) { autorr.auth = true; autorr.ttl = ::arg().asNum("default-ttl"); - if (!have_soa && zonekind != DomainInfo::Slave && zonekind != DomainInfo::Consumer) { + if (!have_soa && zonekind != DomainInfo::Secondary && zonekind != DomainInfo::Consumer) { // synthesize a SOA record so the zone "really" exists string soa = ::arg()["default-soa-content"]; boost::replace_all(soa, "@", zonename.toStringNoDot()); @@ -2011,7 +2011,7 @@ static void apiServerZoneDetail(HttpRequest* req, HttpResponse* resp) { } } - if (!haveSoa && newKind != DomainInfo::Slave && newKind != DomainInfo::Consumer) { + if (!haveSoa && newKind != DomainInfo::Secondary && newKind != DomainInfo::Consumer) { // Require SOA if this is a primary zone. throw ApiException("Must give SOA record for zone when replacing all RR sets"); } @@ -2032,7 +2032,7 @@ static void apiServerZoneDetail(HttpRequest* req, HttpResponse* resp) { di.backend->feedComment(c); } - if (!haveSoa && (newKind == DomainInfo::Slave || newKind == DomainInfo::Consumer)) { + if (!haveSoa && (newKind == DomainInfo::Secondary || newKind == DomainInfo::Consumer)) { di.backend->setStale(di.id); } } else { @@ -2135,7 +2135,7 @@ static void apiServerZoneAxfrRetrieve(HttpRequest* req, HttpResponse* resp) { } if (di.primaries.empty()) - throw ApiException("Domain '" + zonename.toString() + "' is not a slave domain (or has no primary defined)"); + throw ApiException("Domain '" + zonename.toString() + "' is not a secondary domain (or has no primary defined)"); shuffle(di.primaries.begin(), di.primaries.end(), pdns::dns_random_engine()); Communicator.addSuckRequest(zonename, di.primaries.front(), SuckRequest::Api); diff --git a/pdns/zone2sql.cc b/pdns/zone2sql.cc index aaf72f9dc2..a1b6be8714 100644 --- a/pdns/zone2sql.cc +++ b/pdns/zone2sql.cc @@ -204,7 +204,7 @@ try ::arg().setSwitch("gmysql","Output in format suitable for default gmysqlbackend")="no"; ::arg().setSwitch("gsqlite","Output in format suitable for default gsqlitebackend")="no"; ::arg().setSwitch("verbose","Verbose comments on operation")="no"; - ::arg().setSwitch("slave","Keep BIND slaves as slaves. Only works with named-conf.")="no"; + ::arg().setSwitch("slave", "Keep BIND secondaries as secondaries. Only works with named-conf.") = "no"; ::arg().setSwitch("json-comments","Parse json={} field for disabled & comments")="no"; ::arg().setSwitch("transactions","If target SQL supports it, use transactions")="no"; ::arg().setSwitch("on-error-resume-next","Continue after errors")="no";