]> granicus.if.org Git - pdns/commitdiff
Send a notification to all slave servers after every update.
authorKees Monshouwer <mind04@monshouwer.org>
Tue, 27 Dec 2016 13:39:51 +0000 (14:39 +0100)
committermind04 <mind04@monshouwer.org>
Fri, 5 May 2017 14:28:25 +0000 (16:28 +0200)
This will speed up the propagation of changes and is very useful for acme verification.

docs/markdown/authoritative/dnsupdate.md
docs/markdown/authoritative/domainmetadata.md
pdns/rfc2136handler.cc

index 1d6be3f03ed5432af0bddb413cecc3cfcfe19ea9..08e1b9eaab1cfb9850028ca866c9c601ac77b580 100644 (file)
@@ -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).
 
index 70cc38e78c03e3a99ac37513ed2dcb7c26107575..84c9f4bbd3f7292a023c746266e2c53142b12807 100644 (file)
@@ -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
index 9e4df0b30cc91b64296c46e6b4562048b793950d..7d872d5c1708fba253c1cfb821fa3b873d837177 100644 (file)
 #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<string> notify;
+        B.getDomainMetadata(p->qdomain, "NOTIFY-DNSUPDATE", notify);
+        if (!notify.empty() && notify.front() == "1") {
+          Communicator.notifyDomain(di.zone);
+        }
+      }
+
       L<<Logger::Info<<msgPrefix<<"Update completed, "<<changedRecords<<" changed records committed."<<endl;
     } else {
       //No change, no commit, we perform abort() because some backends might like this more.