]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
When emptying a view, purge all its packetcache data.
authorMiod Vallat <miod.vallat@powerdns.com>
Wed, 28 May 2025 12:45:25 +0000 (14:45 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Wed, 11 Jun 2025 05:27:20 +0000 (07:27 +0200)
pdns/ws-auth.cc

index 0463cb8a9662bc21e7ae0d2cf73a992b6784d2e7..f583122e83a1c5acef4786f1088a18a47289fc8c 100644 (file)
@@ -2738,12 +2738,18 @@ static void apiServerViewsDELETE(HttpRequest* req, HttpResponse* resp)
     throw ApiException("Failed to remove " + zoneData.zoneName.toStringFull() + " from view " + view);
   }
   // Notify zone cache of the removed association
+  bool emptyView{false};
   if (g_zoneCache.isEnabled()) {
-    g_zoneCache.removeFromView(view, zoneData.zoneName);
+    emptyView = g_zoneCache.removeFromView(view, zoneData.zoneName);
   }
   // Purge packet cache for that zone
   if (PC.enabled()) {
-    (void)PC.purgeExact(view, zoneData.zoneName.operator const DNSName&());
+    if (emptyView) {
+      (void)PC.purgeView(view);
+    }
+    else {
+      (void)PC.purgeExact(view, zoneData.zoneName.operator const DNSName&());
+    }
   }
 
   resp->body = "";