diff --git a/pdns/auth-main.cc b/pdns/auth-main.cc index 59a3e2111fd7..3aa88e6a639f 100644 --- a/pdns/auth-main.cc +++ b/pdns/auth-main.cc @@ -228,6 +228,7 @@ static void declareArguments() ::arg().setSwitch("prevent-self-notification", "Don't send notifications to what we think is ourself") = "yes"; ::arg().setSwitch("any-to-tcp", "Answer ANY queries with tc=1, shunting to TCP") = "yes"; ::arg().setSwitch("edns-subnet-processing", "If we should act on EDNS Subnet options") = "no"; + ::arg().set("delay-notifications", "Configure a delay to send out notifications, no delay by default") = "0"; ::arg().set("edns-cookie-secret", "When set, set a server cookie when responding to a query with a Client cookie (in hex)") = ""; @@ -326,6 +327,7 @@ static void declareArguments() ::arg().set("rng", "Specify the random number generator to use. Valid values are auto,sodium,openssl,getrandom,arc4random,urandom.") = "auto"; ::arg().set("default-catalog-zone", "Catalog zone to assign newly created primary zones (via the API) to") = ""; + #ifdef ENABLE_GSS_TSIG ::arg().setSwitch("enable-gss-tsig", "Enable GSS TSIG processing") = "no"; #endif diff --git a/pdns/auth-primarycommunicator.cc b/pdns/auth-primarycommunicator.cc index 1ee65e0849a9..1b9ff3b3a493 100644 --- a/pdns/auth-primarycommunicator.cc +++ b/pdns/auth-primarycommunicator.cc @@ -75,7 +75,7 @@ void CommunicatorClass::queueNotifyDomain(const DomainInfo& di, UeberBackend* B) for (const auto& ip : ips) { g_log << Logger::Notice << "Queued notification of domain '" << di.zone << "' to " << ip << endl; - d_nq.add(di.zone, ip); + d_nq.add(di.zone, ip, d_delayNotifications); hasQueuedItem = true; } } @@ -98,7 +98,7 @@ void CommunicatorClass::queueNotifyDomain(const DomainInfo& di, UeberBackend* B) g_log << Logger::Notice << "Queued also-notification of domain '" << di.zone << "' to " << caIp.toStringWithPort() << endl; if (!ips.count(caIp.toStringWithPort())) { ips.insert(caIp.toStringWithPort()); - d_nq.add(di.zone, caIp.toStringWithPort()); + d_nq.add(di.zone, caIp.toStringWithPort(), d_delayNotifications); } hasQueuedItem = true; } diff --git a/pdns/communicator.cc b/pdns/communicator.cc index 20cadfd7bfbc..2f43db2873f5 100644 --- a/pdns/communicator.cc +++ b/pdns/communicator.cc @@ -100,6 +100,11 @@ void CommunicatorClass::go() d_preventSelfNotification = ::arg().mustDo("prevent-self-notification"); + auto delay = ::arg().asNum("delay-notifications"); + if (delay > 0) { + d_delayNotifications = static_cast(delay); + } + try { d_onlyNotify.toMasks(::arg()["only-notify"]); } diff --git a/pdns/communicator.hh b/pdns/communicator.hh index 20ac6c572348..fcb13dd4f90f 100644 --- a/pdns/communicator.hh +++ b/pdns/communicator.hh @@ -68,7 +68,7 @@ typedef UniQueue::index::type domains_by_name_t; class NotificationQueue { public: - void add(const DNSName &domain, const string &ip) + void add(const DNSName &domain, const string &ip, time_t delay = 0) { const ComboAddress caIp(ip); @@ -77,7 +77,7 @@ public: nr.ip = caIp.toStringWithPort(); nr.attempts = 0; nr.id = dns_random_uint16(); - nr.next = time(0); + nr.next = time(nullptr) + delay; d_nqueue.push_back(nr); } @@ -195,6 +195,7 @@ private: time_t d_tickinterval; bool d_secondarieschanged; bool d_preventSelfNotification; + time_t d_delayNotifications{0}; struct Data {