From b68af3ee48054ebce87aec3df89abf75a71f8c49 Mon Sep 17 00:00:00 2001 From: phonedph1 Date: Thu, 23 Aug 2018 17:27:02 +0000 Subject: [PATCH] Purge all auth/forward zone data including subtree. Previously this would miss purging out removed entries/data. --- pdns/reczones.cc | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/pdns/reczones.cc b/pdns/reczones.cc index 15bad547ef..e2625c4e30 100644 --- a/pdns/reczones.cc +++ b/pdns/reczones.cc @@ -245,13 +245,6 @@ string reloadAuthAndForwards() try { g_log<(boost::bind(pleaseWipeCache, j.d_name, false)); - } - } - string configname=::arg()["config-dir"]+"/recursor.conf"; if(::arg()["config-name"]!="") { configname=::arg()["config-dir"]+"/recursor-"+::arg()["config-name"]+".conf"; @@ -290,12 +283,23 @@ string reloadAuthAndForwards() ::arg().preParse(g_argc, g_argv, "serve-rfc1918"); std::shared_ptr newDomainMap = parseAuthAndForwards(); - - // purge again - new zones need to blank out the cache + + // purge both original and new names + std::set oldAndNewDomains; for(const auto& i : *newDomainMap) { - broadcastAccFunction(boost::bind(pleaseWipeCache, i.first, true)); - broadcastAccFunction(boost::bind(pleaseWipePacketCache, i.first, true)); - broadcastAccFunction(boost::bind(pleaseWipeAndCountNegCache, i.first, true)); + oldAndNewDomains.insert(i.first); + } + + if(original) { + for(const auto& i : *original) { + oldAndNewDomains.insert(i.first); + } + } + + for(const auto i : oldAndNewDomains) { + broadcastAccFunction(boost::bind(pleaseWipeCache, i, true)); + broadcastAccFunction(boost::bind(pleaseWipePacketCache, i, true)); + broadcastAccFunction(boost::bind(pleaseWipeAndCountNegCache, i, true)); } broadcastFunction(boost::bind(pleaseUseNewSDomainsMap, newDomainMap)); -- 2.47.2