]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - pdns/rfc2136handler.cc
Send a notification to all slave servers after every update.
[thirdparty/pdns.git] / pdns / rfc2136handler.cc
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.