]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Send a notification to all slave servers after every update. 5264/head
authorKees Monshouwer <mind04@monshouwer.org>
Tue, 27 Dec 2016 13:39:51 +0000 (14:39 +0100)
committermind04 <mind04@monshouwer.org>
Sun, 23 Apr 2017 18:42:56 +0000 (20:42 +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
pdns/ws-auth.cc

index 7234c271542a8c5343bb37cf46144b4eafaf9329..cc5c7f19e3aba1b497c4eb1eeda215282e6a40cd 100644 (file)
@@ -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).
 
index 3d95454786b99296a9ad7354ab8eca3633ed53c6..089bcd0b6fc947d85579e9703d816ff2e0f5d32f 100644 (file)
@@ -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
index 588610f64dd8e38ba2e21eaa5e9c1e432a3adfa1..dfe16b90f28c155a9f249b257abb58438b317f22 100644 (file)
 #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<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.
index 30507299449547c0abf1424d7b542c42097e4519..2129964dc5919575f85445c094075391f396a984 100644 (file)
@@ -530,6 +530,7 @@ static bool isValidMetadataKind(const string& kind, bool readonly) {
     "TSIG-ALLOW-DNSUPDATE",
     "FORWARD-DNSUPDATE",
     "SOA-EDIT-DNSUPDATE",
+    "NOTIFY-DNSUPDATE",
     "ALSO-NOTIFY",
     "AXFR-MASTER-TSIG",
     "GSS-ALLOW-AXFR-PRINCIPAL",