From a35b6b1610699df2a59228cecb8ebc662181d34e Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Tue, 27 Dec 2016 14:39:51 +0100 Subject: [PATCH] Send a notification to all slave servers after every update. This will speed up the propagation of changes and is very useful for acme verification. --- docs/markdown/authoritative/dnsupdate.md | 9 +++++++++ docs/markdown/authoritative/domainmetadata.md | 2 +- pdns/rfc2136handler.cc | 11 +++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/markdown/authoritative/dnsupdate.md b/docs/markdown/authoritative/dnsupdate.md index 1d6be3f03e..08e1b9eaab 100644 --- a/docs/markdown/authoritative/dnsupdate.md +++ b/docs/markdown/authoritative/dnsupdate.md @@ -83,6 +83,15 @@ sql> insert into domainmetadata(domain_id, kind, content) values(5, ‘FORWARD-D There is no content, the existence of the entry enables the forwarding. This domain-specific setting is only useful when the configuration option **forward-dnsupdate** is set to 'no', as that will disable it globally. Using the domainmetadata setting than allows you to enable it per domain. +## NOTIFY-DNSUPDATE +Send a notification to all slave servers after every update. This will speed up the propagation of changes and is very useful for acme verification. + +``` +sql> select id from domains where name='example.org'; +5 +sql> insert into domainmetadata(domain_id, kind, content) values(5, ‘NOTIFY-DNSUPDATE’,’1’); +``` + ## SOA-EDIT-DNSUPDATE This configures how the soa serial should be updated. See [below](#soa-serial-updates). diff --git a/docs/markdown/authoritative/domainmetadata.md b/docs/markdown/authoritative/domainmetadata.md index 70cc38e78c..84c9f4bbd3 100644 --- a/docs/markdown/authoritative/domainmetadata.md +++ b/docs/markdown/authoritative/domainmetadata.md @@ -33,7 +33,7 @@ To dissallow all IP's, except those explicitly allowed by domainmetadata records ## AXFR-SOURCE The IP address to use as a source address for sending AXFR and IXFR requests. -## ALLOW-DNSUPDATE-FROM, TSIG-ALLOW-DNSUPDATE, FORWARD-DNSUPDATE, SOA-EDIT-DNSUPDATE +## ALLOW-DNSUPDATE-FROM, TSIG-ALLOW-DNSUPDATE, FORWARD-DNSUPDATE, SOA-EDIT-DNSUPDATE, NOTIFY-DNSUPDATE See the documentation on [Dynamic DNS update](dnsupdate.md) ## ALSO-NOTIFY diff --git a/pdns/rfc2136handler.cc b/pdns/rfc2136handler.cc index 9e4df0b30c..7d872d5c17 100644 --- a/pdns/rfc2136handler.cc +++ b/pdns/rfc2136handler.cc @@ -14,9 +14,11 @@ #include "resolver.hh" #include "dns_random.hh" #include "backends/gsql/ssql.hh" +#include "communicator.hh" extern PacketCache PC; extern StatBag S; +extern CommunicatorClass Communicator; pthread_mutex_t PacketHandler::s_rfc2136lock=PTHREAD_MUTEX_INITIALIZER; @@ -947,6 +949,15 @@ int PacketHandler::processUpdate(DNSPacket *p) { zone.append("$"); PC.purge(zone); + // Notify slaves + if (di.kind == DomainInfo::Master) { + vector notify; + B.getDomainMetadata(p->qdomain, "NOTIFY-DNSUPDATE", notify); + if (!notify.empty() && notify.front() == "1") { + Communicator.notifyDomain(di.zone); + } + } + L<