From: Kees Monshouwer Date: Tue, 27 Dec 2016 13:39:51 +0000 (+0100) Subject: Send a notification to all slave servers after every update. X-Git-Tag: rec-4.1.0-alpha1~123^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4c5b692563c040b964a969e5ac4ea686c276006c;p=thirdparty%2Fpdns.git 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. --- diff --git a/docs/markdown/authoritative/dnsupdate.md b/docs/markdown/authoritative/dnsupdate.md index 7234c27154..cc5c7f19e3 100644 --- a/docs/markdown/authoritative/dnsupdate.md +++ b/docs/markdown/authoritative/dnsupdate.md @@ -88,6 +88,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 3d95454786..089bcd0b6f 100644 --- a/docs/markdown/authoritative/domainmetadata.md +++ b/docs/markdown/authoritative/domainmetadata.md @@ -33,7 +33,7 @@ To disallow 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 588610f64d..dfe16b90f2 100644 --- a/pdns/rfc2136handler.cc +++ b/pdns/rfc2136handler.cc @@ -15,8 +15,10 @@ #include "resolver.hh" #include "dns_random.hh" #include "backends/gsql/ssql.hh" +#include "communicator.hh" extern StatBag S; +extern CommunicatorClass Communicator; pthread_mutex_t PacketHandler::s_rfc2136lock=PTHREAD_MUTEX_INITIALIZER; @@ -968,6 +970,15 @@ int PacketHandler::processUpdate(DNSPacket *p) { zone.append("$"); purgeAuthCaches(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<