]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Check in more places if the config policy has been updated before 10627/head
authorOtto <otto.moerbeek@open-xchange.com>
Tue, 3 Aug 2021 07:08:09 +0000 (09:08 +0200)
committerOtto <otto.moerbeek@open-xchange.com>
Tue, 3 Aug 2021 07:08:09 +0000 (09:08 +0200)
using or modifying it.

pdns/rpzloader.cc

index 22b63ef3fa00e4dfabd0a9d5b62318310f8aee8e..77cf0926c23251dc11495d985b0abd805f1483ca 100644 (file)
@@ -469,7 +469,15 @@ void RPZIXFRTracker(const std::vector<ComboAddress>& primaries, boost::optional<
     try {
       g_log<<Logger::Info<<"Processing "<<deltas.size()<<" delta"<<addS(deltas)<<" for RPZ "<<zoneName<<endl;
 
+      if (luaconfsLocal->generation != configGeneration) {
+        g_log<<Logger::Info<<"A more recent configuration has been found, stopping the existing RPZ update thread for "<<zoneName<<endl;
+        return;
+      }
       oldZone = luaconfsLocal->dfe.getZone(zoneIdx);
+      if (!oldZone || oldZone->getDomain() != zoneName) {
+        g_log<<Logger::Info<<"This policy is no more, stopping the existing RPZ update thread for "<<zoneName << endl;
+        return;
+      }
       /* we need to make a _full copy_ of the zone we are going to work on */
       std::shared_ptr<DNSFilterEngine::Zone> newZone = std::make_shared<DNSFilterEngine::Zone>(*oldZone);
       /* initialize the current serial to the last one */
@@ -540,6 +548,10 @@ void RPZIXFRTracker(const std::vector<ComboAddress>& primaries, boost::optional<
          but we don't want to touch anything else, especially other zones,
          since they might have been updated by another RPZ IXFR tracker thread.
       */
+      if (luaconfsLocal->generation != configGeneration) {
+        g_log<<Logger::Info<<"A more recent configuration has been found, stopping the existing RPZ update thread for "<<zoneName<<endl;
+        return;
+      }
       g_luaconfs.modify([zoneIdx, &newZone](LuaConfigItems& lci) {
                           lci.dfe.setZone(zoneIdx, newZone);
                         });