Also AXFR a zone from a master with a lower serial.
-.. _setting-domain-cache-ttl:
-
-``domain-cache-ttl``
---------------------
-
-- Integer
-- Default: 0
-
-Seconds to cache a list of all known domains. A value of 0 will disable the cache.
-
-If your backends do not respond to unknown domains, it is suggested to enable :ref:`setting-consistent-backends` and set this option to `60`.
-
.. _setting-cache-ttl:
``cache-ttl``
Specifies the maximum number of received megabytes allowed on an
incoming AXFR/IXFR update, to prevent resource exhaustion. A value of 0
means no restriction.
+
+.. _setting-zone-cache-refresh-interval:
+
+``zone-cache-refresh-interval``
+-------------------------------
+
+- Integer
+- Default: 0
+
+Seconds to cache a list of all known zones. A value of 0 will disable the cache.
+
+If your backends do not respond to unknown or dynamically generated zones, it is suggested to enable :ref:`setting-consistent-backends` and set this option to `60`.
#include "pdns/misc.hh"
#include "pdns/dynlistener.hh"
#include "pdns/lock.hh"
-#include "pdns/auth-domaincache.hh"
+#include "pdns/auth-zonecache.hh"
/*
All instances of this backend share one s_state, which is indexed by zone name and zone id.
safePutBBDomainInfo(bbd);
- g_domainCache.add(domainname, bbd.d_id); // make new domain visible
+ g_zoneCache.add(domainname, bbd.d_id); // make new zone visible
g_log << Logger::Warning << "Zone " << domainname << " loaded" << endl;
return "Loaded zone " + domainname.toLogString() + " from " + filename;
libtestremotebackend_la_SOURCES = \
../../pdns/arguments.hh ../../pdns/arguments.cc \
- ../../pdns/auth-domaincache.cc ../../pdns/auth-domaincache.hh \
../../pdns/auth-packetcache.cc ../../pdns/auth-packetcache.hh \
../../pdns/auth-querycache.cc ../../pdns/auth-querycache.hh \
+ ../../pdns/auth-zonecache.cc ../../pdns/auth-zonecache.hh \
../../pdns/base32.cc \
../../pdns/base64.cc \
../../pdns/dns.hh ../../pdns/dns.cc \
#include "pdns/arguments.hh"
#include "pdns/json.hh"
#include "pdns/statbag.hh"
-#include "pdns/auth-domaincache.hh"
#include "pdns/auth-packetcache.hh"
#include "pdns/auth-querycache.hh"
+#include "pdns/auth-zonecache.hh"
StatBag S;
-AuthDomainCache g_domainCache;
AuthPacketCache PC;
AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
ArgvMap& arg()
{
static ArgvMap arg;
#include "pdns/arguments.hh"
#include "pdns/json.hh"
#include "pdns/statbag.hh"
-#include "pdns/auth-domaincache.hh"
#include "pdns/auth-packetcache.hh"
#include "pdns/auth-querycache.hh"
+#include "pdns/auth-zonecache.hh"
StatBag S;
-AuthDomainCache g_domainCache;
AuthPacketCache PC;
AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
ArgvMap& arg()
{
static ArgvMap arg;
#include "pdns/dnsrecords.hh"
#include "pdns/json.hh"
#include "pdns/statbag.hh"
-#include "pdns/auth-domaincache.hh"
#include "pdns/auth-packetcache.hh"
#include "pdns/auth-querycache.hh"
+#include "pdns/auth-zonecache.hh"
StatBag S;
-AuthDomainCache g_domainCache;
AuthPacketCache PC;
AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
ArgvMap& arg()
{
static ArgvMap arg;
#include "pdns/arguments.hh"
#include "pdns/json.hh"
#include "pdns/statbag.hh"
-#include "pdns/auth-domaincache.hh"
#include "pdns/auth-packetcache.hh"
#include "pdns/auth-querycache.hh"
+#include "pdns/auth-zonecache.hh"
StatBag S;
-AuthDomainCache g_domainCache;
AuthPacketCache PC;
AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
ArgvMap& arg()
{
static ArgvMap arg;
#include "pdns/dnsrecords.hh"
#include "pdns/json.hh"
#include "pdns/statbag.hh"
-#include "pdns/auth-domaincache.hh"
#include "pdns/auth-packetcache.hh"
#include "pdns/auth-querycache.hh"
+#include "pdns/auth-zonecache.hh"
StatBag S;
-AuthDomainCache g_domainCache;
AuthPacketCache PC;
AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
ArgvMap& arg()
{
static ArgvMap arg;
#include "pdns/dnsrecords.hh"
#include "pdns/json.hh"
#include "pdns/statbag.hh"
-#include "pdns/auth-domaincache.hh"
#include "pdns/auth-packetcache.hh"
#include "pdns/auth-querycache.hh"
+#include "pdns/auth-zonecache.hh"
StatBag S;
-AuthDomainCache g_domainCache;
AuthPacketCache PC;
AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
ArgvMap& arg()
{
static ArgvMap arg;
ascii.hh \
auth-caches.cc auth-caches.hh \
auth-carbon.cc \
- auth-domaincache.cc auth-domaincache.hh \
auth-packetcache.cc auth-packetcache.hh \
auth-querycache.cc auth-querycache.hh \
+ auth-zonecache.cc auth-zonecache.hh \
axfr-retriever.cc axfr-retriever.hh \
backends/gsql/gsqlbackend.cc backends/gsql/gsqlbackend.hh \
backends/gsql/ssql.hh \
pdnsutil_SOURCES = \
arguments.cc \
auth-caches.cc auth-caches.hh \
- auth-domaincache.cc auth-domaincache.hh \
auth-packetcache.cc auth-packetcache.hh \
auth-querycache.cc auth-querycache.hh \
+ auth-zonecache.cc auth-zonecache.hh \
backends/gsql/gsqlbackend.cc backends/gsql/gsqlbackend.hh \
backends/gsql/ssql.hh \
base32.cc \
testrunner_SOURCES = \
arguments.cc \
auth-caches.cc auth-caches.hh \
- auth-domaincache.cc auth-domaincache.hh \
auth-packetcache.cc auth-packetcache.hh \
auth-querycache.cc auth-querycache.hh \
+ auth-zonecache.cc auth-zonecache.hh \
base32.cc \
base64.cc \
bindlexer.l \
stubresolver.hh stubresolver.cc \
svc-records.cc svc-records.hh \
test-arguments_cc.cc \
- test-auth-domaincache_cc.cc \
+ test-auth-zonecache_cc.cc \
test-base32_cc.cc \
test-base64_cc.cc \
test-bindparser_cc.cc \
#include "config.h"
#endif
-#include "auth-domaincache.hh"
+#include "auth-zonecache.hh"
#include "logger.hh"
#include "statbag.hh"
#include "arguments.hh"
#include "cachecleaner.hh"
extern StatBag S;
-AuthDomainCache::AuthDomainCache(size_t mapsCount) :
+AuthZoneCache::AuthZoneCache(size_t mapsCount) :
d_maps(mapsCount)
{
- S.declare("domain-cache-hit", "Number of domain cache hits");
- S.declare("domain-cache-miss", "Number of domain cache misses");
- S.declare("domain-cache-size", "Number of entries in the domain cache", StatType::gauge);
+ S.declare("zone-cache-hit", "Number of zone cache hits");
+ S.declare("zone-cache-miss", "Number of zone cache misses");
+ S.declare("zone-cache-size", "Number of entries in the zone cache", StatType::gauge);
- d_statnumhit = S.getPointer("domain-cache-hit");
- d_statnummiss = S.getPointer("domain-cache-miss");
- d_statnumentries = S.getPointer("domain-cache-size");
-
- d_ttl = 0;
+ d_statnumhit = S.getPointer("zone-cache-hit");
+ d_statnummiss = S.getPointer("zone-cache-miss");
+ d_statnumentries = S.getPointer("zone-cache-size");
}
-AuthDomainCache::~AuthDomainCache()
+AuthZoneCache::~AuthZoneCache()
{
try {
vector<WriteLock> locks;
}
}
-bool AuthDomainCache::getEntry(const DNSName& domain, int& zoneId)
+bool AuthZoneCache::getEntry(const DNSName& zone, int& zoneId)
{
- auto& mc = getMap(domain);
+ auto& mc = getMap(zone);
bool found = false;
{
ReadLock rl(mc.d_mut);
- auto iter = mc.d_map.find(domain);
+ auto iter = mc.d_map.find(zone);
if (iter != mc.d_map.end()) {
found = true;
zoneId = iter->second.zoneId;
return found;
}
-bool AuthDomainCache::isEnabled() const
+bool AuthZoneCache::isEnabled() const
{
- return d_ttl > 0;
+ return d_refreshinterval > 0;
}
-void AuthDomainCache::clear()
+void AuthZoneCache::clear()
{
purgeLockedCollectionsVector(d_maps);
}
-void AuthDomainCache::replace(const vector<tuple<DNSName, int>>& domain_indices)
+void AuthZoneCache::replace(const vector<tuple<DNSName, int>>& zone_indices)
{
- if (!d_ttl)
+ if (!d_refreshinterval)
return;
- size_t count = domain_indices.size();
+ size_t count = zone_indices.size();
vector<MapCombo> newMaps(d_maps.size());
// build new maps
- for (const tuple<DNSName, int>& tup : domain_indices) {
- const DNSName& domain = tup.get<0>();
+ for (const tuple<DNSName, int>& tup : zone_indices) {
+ const DNSName& zone = tup.get<0>();
CacheValue val;
val.zoneId = tup.get<1>();
- auto& mc = newMaps[getMapIndex(domain)];
- mc.d_map.emplace(domain, val);
+ auto& mc = newMaps[getMapIndex(zone)];
+ mc.d_map.emplace(zone, val);
}
{
WriteLock globalLock(d_mut);
if (d_replacePending) {
- // add/replace all domains created while data collection for replace() was already in progress.
+ // add/replace all zones created while data collection for replace() was already in progress.
for (const tuple<DNSName, int>& tup : d_pendingAdds) {
- const DNSName& domain = tup.get<0>();
+ const DNSName& zone = tup.get<0>();
CacheValue val;
val.zoneId = tup.get<1>();
- auto& mc = newMaps[getMapIndex(domain)];
- mc.d_map[domain] = val;
+ auto& mc = newMaps[getMapIndex(zone)];
+ mc.d_map[zone] = val;
}
}
d_statnumentries->store(count);
}
-void AuthDomainCache::add(const DNSName& domain, const int zoneId)
+void AuthZoneCache::add(const DNSName& zone, const int zoneId)
{
- if (!d_ttl)
+ if (!d_refreshinterval)
return;
{
WriteLock globalLock(d_mut);
if (d_replacePending) {
- d_pendingAdds.push_back({domain, zoneId});
+ d_pendingAdds.push_back({zone, zoneId});
}
}
CacheValue val;
val.zoneId = zoneId;
- int mapIndex = getMapIndex(domain);
+ int mapIndex = getMapIndex(zone);
{
auto& mc = d_maps[mapIndex];
WriteLock mcLock(mc.d_mut);
- mc.d_map.emplace(domain, val);
+ mc.d_map.emplace(zone, val);
}
}
-void AuthDomainCache::setReplacePending()
+void AuthZoneCache::setReplacePending()
{
- if (!d_ttl)
+ if (!d_refreshinterval)
return;
{
#include "lock.hh"
#include "misc.hh"
-class AuthDomainCache : public boost::noncopyable
+class AuthZoneCache : public boost::noncopyable
{
public:
- AuthDomainCache(size_t mapsCount = 1024);
- ~AuthDomainCache();
+ AuthZoneCache(size_t mapsCount = 1024);
+ ~AuthZoneCache();
- void replace(const vector<tuple<DNSName, int>>& domains);
- void add(const DNSName& domain, const int zoneId);
+ void replace(const vector<tuple<DNSName, int>>& zone);
+ void add(const DNSName& zone, const int zoneId);
void setReplacePending(); //!< call this when data collection for the subsequent replace() call starts.
- bool getEntry(const DNSName& domain, int& zoneId);
+ bool getEntry(const DNSName& zone, int& zoneId);
size_t size() { return *d_statnumentries; } //!< number of entries in the cache
- uint32_t getTTL() const
+ uint32_t getRefreshInterval() const
{
- return d_ttl;
+ return d_refreshinterval;
}
- void setTTL(uint32_t ttl)
+ void setRefreshInterval(uint32_t interval)
{
- d_ttl = ttl;
+ d_refreshinterval = interval;
}
bool isEnabled() const;
};
vector<MapCombo> d_maps;
- size_t getMapIndex(const DNSName& domain)
+ size_t getMapIndex(const DNSName& zone)
{
- return domain.hash() % d_maps.size();
+ return zone.hash() % d_maps.size();
}
MapCombo& getMap(const DNSName& qname)
{
AtomicCounter* d_statnummiss;
AtomicCounter* d_statnumentries;
- time_t d_ttl{0};
+ time_t d_refreshinterval{0};
ReadWriteLock d_mut;
std::vector<tuple<DNSName, int>> d_pendingAdds;
bool d_replacePending{false};
};
-extern AuthDomainCache g_domainCache;
+extern AuthZoneCache g_zoneCache;
StatBag S; //!< Statistics are gathered across PDNS via the StatBag class S
AuthPacketCache PC; //!< This is the main PacketCache, shared across all threads
AuthQueryCache QC;
-AuthDomainCache g_domainCache;
+AuthZoneCache g_zoneCache;
std::unique_ptr<DNSProxy> DP{nullptr};
std::unique_ptr<DynListener> dl{nullptr};
CommunicatorClass Communicator;
::arg().set("cache-ttl","Seconds to store packets in the PacketCache")="20";
::arg().set("negquery-cache-ttl","Seconds to store negative query results in the QueryCache")="60";
::arg().set("query-cache-ttl","Seconds to store query results in the QueryCache")="20";
- ::arg().set("domain-cache-ttl", "Seconds to cache list of known domains") = "0";
+ ::arg().set("zone-cache-refresh-interval", "Seconds to cache list of known zones") = "0";
::arg().set("server-id", "Returned when queried for 'id.server' TXT or NSID, defaults to hostname - disabled or custom")="";
::arg().set("default-soa-content","Default SOA content")="a.misconfigured.dns.server.invalid hostmaster.@ 0 10800 3600 604800 3600";
::arg().set("default-soa-edit","Default SOA-EDIT value")="";
const uint32_t secpollInterval = 1800;
uint32_t secpollSince = 0;
- uint32_t domainCacheUpdateSince = 0;
+ uint32_t zoneCacheUpdateSince = 0;
for(;;) {
- const uint32_t sleeptime = g_domainCache.getTTL() == 0 ? secpollInterval : std::min(secpollInterval, g_domainCache.getTTL());
+ const uint32_t sleeptime = g_zoneCache.getRefreshInterval() == 0 ? secpollInterval : std::min(secpollInterval, g_zoneCache.getRefreshInterval());
sleep(sleeptime); // if any signals arrive, we might run more often than expected.
- domainCacheUpdateSince += sleeptime;
- if (domainCacheUpdateSince >= g_domainCache.getTTL()) {
+ zoneCacheUpdateSince += sleeptime;
+ if (zoneCacheUpdateSince >= g_zoneCache.getRefreshInterval()) {
try {
UeberBackend B;
- B.updateDomainCache();
- domainCacheUpdateSince = 0;
+ B.updateZoneCache();
+ zoneCacheUpdateSince = 0;
}
catch(PDNSException &e) {
- g_log<<Logger::Error<<"PDNSException while updating domain cache: "<<e.reason<<endl;
+ g_log<<Logger::Error<<"PDNSException while updating zone cache: "<<e.reason<<endl;
}
catch(std::exception &e) {
- g_log<<Logger::Error<<"STL Exception while updating domain cache: "<<e.what()<<endl;
+ g_log<<Logger::Error<<"STL Exception while updating zone cache: "<<e.what()<<endl;
}
}
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
-#include "auth-domaincache.hh"
#include "auth-packetcache.hh"
#include "auth-querycache.hh"
+#include "auth-zonecache.hh"
#include "utility.hh"
#include "arguments.hh"
#include "communicator.hh"
#include "dnsbackend.hh"
#include "ueberbackend.hh"
#include "arguments.hh"
-#include "auth-domaincache.hh"
#include "auth-packetcache.hh"
#include "auth-querycache.hh"
+#include "auth-zonecache.hh"
#include "zoneparser-tng.hh"
#include "signingpipe.hh"
#include "dns_random.hh"
StatBag S;
AuthPacketCache PC;
AuthQueryCache QC;
-AuthDomainCache g_domainCache;
+AuthZoneCache g_zoneCache;
namespace po = boost::program_options;
po::variables_map g_vm;
}
}
- g_domainCache.setTTL(::arg().asNum("domain-cache-ttl"));
+ g_zoneCache.setRefreshInterval(::arg().asNum("zone-cache-refresh-interval"));
{
UeberBackend B;
- B.updateDomainCache();
+ B.updateZoneCache();
}
UeberBackend::go();
#include <boost/test/unit_test.hpp>
-#include "auth-domaincache.hh"
+#include "auth-zonecache.hh"
#include "misc.hh"
-BOOST_AUTO_TEST_SUITE(test_auth_domaincache_cc)
+BOOST_AUTO_TEST_SUITE(test_auth_zonecache_cc)
BOOST_AUTO_TEST_CASE(test_replace)
{
- AuthDomainCache cache;
- cache.setTTL(3600);
+ AuthZoneCache cache;
+ cache.setRefreshInterval(3600);
- vector<tuple<DNSName, int>> domain_indices{
+ vector<tuple<DNSName, int>> zone_indices{
{DNSName("example.org."), 1},
};
- cache.replace(domain_indices);
+ cache.replace(zone_indices);
int zoneId = 0;
bool found = cache.getEntry(DNSName("example.org."), zoneId);
if (!found || zoneId != 1) {
- BOOST_FAIL("domain added in replace() not found");
+ BOOST_FAIL("zone added in replace() not found");
}
}
BOOST_AUTO_TEST_CASE(test_add_while_pending_replace)
{
- AuthDomainCache cache;
- cache.setTTL(3600);
+ AuthZoneCache cache;
+ cache.setRefreshInterval(3600);
- vector<tuple<DNSName, int>> domain_indices{
+ vector<tuple<DNSName, int>> zone_indices{
{DNSName("powerdns.org."), 1}};
cache.setReplacePending();
cache.add(DNSName("example.org."), 2);
- cache.replace(domain_indices);
+ cache.replace(zone_indices);
int zoneId = 0;
bool found = cache.getEntry(DNSName("example.org."), zoneId);
if (!found || zoneId != 2) {
- BOOST_FAIL("domain added while replace was pending not found");
+ BOOST_FAIL("zone added while replace was pending not found");
}
}
-// Add domain using .add(), but also in the .replace() data
+// Add zone using .add(), but also in the .replace() data
BOOST_AUTO_TEST_CASE(test_add_while_pending_replace_duplicate)
{
- AuthDomainCache cache;
- cache.setTTL(3600);
+ AuthZoneCache cache;
+ cache.setRefreshInterval(3600);
- vector<tuple<DNSName, int>> domain_indices{
+ vector<tuple<DNSName, int>> zone_indices{
{DNSName("powerdns.org."), 1},
{DNSName("example.org."), 2},
};
cache.setReplacePending();
cache.add(DNSName("example.org."), 3);
- cache.replace(domain_indices);
+ cache.replace(zone_indices);
int zoneId = 0;
bool found = cache.getEntry(DNSName("example.org."), zoneId);
if (!found || zoneId == 0) {
- BOOST_FAIL("domain added while replace was pending not found");
+ BOOST_FAIL("zone added while replace was pending not found");
}
if (zoneId != 3) {
BOOST_FAIL(string("zoneId got overwritten using replace() data (zoneId=") + std::to_string(zoneId) + ")");
#include <boost/multi_index/key_extractors.hpp>
#include "arguments.hh"
-#include "auth-domaincache.hh"
#include "auth-querycache.hh"
+#include "auth-zonecache.hh"
#include "ueberbackend.hh"
class SimpleBackend : public DNSBackend
::arg().set("negquery-cache-ttl")="0";
::arg().set("consistent-backends")="no";
QC.cleanup();
- ::arg().set("domain-cache-ttl")="0";
- g_domainCache.clear();
+ ::arg().set("zone-cache-refresh-interval")="0";
+ g_zoneCache.clear();
BackendMakers().clear();
SimpleBackend::s_zones.clear();
SimpleBackend::s_metadata.clear();
::arg().set("query-cache-ttl")="0";
::arg().set("negquery-cache-ttl")="0";
QC.cleanup();
- /* keep domain cache disabled */
- ::arg().set("domain-cache-ttl")="0";
- g_domainCache.clear();
+ /* keep zone cache disabled */
+ ::arg().set("zone-cache-refresh-interval")="0";
+ g_zoneCache.clear();
UeberBackend ub;
func(ub);
::arg().set("query-cache-ttl")="20";
::arg().set("negquery-cache-ttl")="60";
QC.cleanup();
- /* keep domain cache disabled */
- ::arg().set("domain-cache-ttl")="0";
- g_domainCache.clear();
+ /* keep zone cache disabled */
+ ::arg().set("zone-cache-refresh-interval")="0";
+ g_zoneCache.clear();
UeberBackend ub;
/* a first time to fill the cache */
}
}
-static void testWithoutThenWithDomainCache(std::function<void(UeberBackend& ub)> func)
+static void testWithoutThenWithZoneCache(std::function<void(UeberBackend& ub)> func)
{
extern AuthQueryCache QC;
{
- /* disable domain cache */
- ::arg().set("domain-cache-ttl")="0";
- g_domainCache.clear();
+ /* disable zone cache */
+ ::arg().set("zone-cache-refresh-interval")="0";
+ g_zoneCache.clear();
/* keep auth caches disabled */
::arg().set("query-cache-ttl")="0";
::arg().set("negquery-cache-ttl")="0";
}
{
- /* enable domain cache */
- ::arg().set("domain-cache-ttl")="0";
- g_domainCache.clear();
+ /* enable zone cache */
+ ::arg().set("zone-cache-refresh-interval")="0";
+ g_zoneCache.clear();
/* keep auth caches disabled */
::arg().set("query-cache-ttl")="0";
::arg().set("negquery-cache-ttl")="0";
QC.cleanup();
UeberBackend ub;
- ub.updateDomainCache();
+ ub.updateZoneCache();
/* a first time to fill the cache */
func(ub);
/* a second time to make sure every call has been tried with the cache filled */
};
testWithoutThenWithAuthCache(testFunction);
- testWithoutThenWithDomainCache(testFunction);
+ testWithoutThenWithZoneCache(testFunction);
}
catch(const PDNSException& e) {
cerr<<e.reason<<endl;
};
testWithoutThenWithAuthCache(testFunction);
- testWithoutThenWithDomainCache(testFunction);
+ testWithoutThenWithZoneCache(testFunction);
}
catch(const PDNSException& e) {
cerr<<e.reason<<endl;
};
testWithoutThenWithAuthCache(testFunction);
- testWithoutThenWithDomainCache(testFunction);
+ testWithoutThenWithZoneCache(testFunction);
}
catch(const PDNSException& e) {
cerr<<e.reason<<endl;
};
testWithoutThenWithAuthCache(testFunction);
- testWithoutThenWithDomainCache(testFunction);
+ testWithoutThenWithZoneCache(testFunction);
}
catch(const PDNSException& e) {
cerr<<e.reason<<endl;
};
testWithoutThenWithAuthCache(testFunction);
- testWithoutThenWithDomainCache(testFunction);
+ testWithoutThenWithZoneCache(testFunction);
}
catch(const PDNSException& e) {
cerr<<e.reason<<endl;
};
testWithoutThenWithAuthCache(testFunction);
- testWithoutThenWithDomainCache(testFunction);
+ testWithoutThenWithZoneCache(testFunction);
}
catch(const PDNSException& e) {
cerr<<e.reason<<endl;
#endif
#include <boost/test/unit_test.hpp>
#include "arguments.hh"
-#include "auth-domaincache.hh"
#include "auth-packetcache.hh"
#include "auth-querycache.hh"
+#include "auth-zonecache.hh"
#include "statbag.hh"
StatBag S;
-AuthDomainCache g_domainCache;
AuthPacketCache PC;
AuthQueryCache QC;
+AuthZoneCache g_zoneCache;
ArgvMap &arg()
{
#include <boost/archive/binary_oarchive.hpp>
#include "auth-querycache.hh"
-#include "auth-domaincache.hh"
+#include "auth-zonecache.hh"
#include "utility.hh"
}
}
if (success) {
- g_domainCache.add(domain, zoneId); // make new domain visible
+ g_zoneCache.add(domain, zoneId); // make new zone visible
}
return success;
}
}
}
-void UeberBackend::updateDomainCache() {
- if (!g_domainCache.isEnabled()) {
+void UeberBackend::updateZoneCache() {
+ if (!g_zoneCache.isEnabled()) {
return;
}
- vector<tuple<DNSName, int>> domain_indices;
- g_domainCache.setReplacePending();
+ vector<tuple<DNSName, int>> zone_indices;
+ g_zoneCache.setReplacePending();
for (vector<DNSBackend*>::iterator i = backends.begin(); i != backends.end(); ++i )
{
- vector<DomainInfo> domains;
- (*i)->getAllDomains(&domains, true);
- for(auto& di: domains) {
- domain_indices.push_back({std::move(di.zone), (int)di.id}); // this cast should not be necessary
+ vector<DomainInfo> zones;
+ (*i)->getAllDomains(&zones, true);
+ for(auto& di: zones) {
+ zone_indices.push_back({std::move(di.zone), (int)di.id}); // this cast should not be necessary
}
}
- g_domainCache.replace(domain_indices);
+ g_zoneCache.replace(zone_indices);
}
void UeberBackend::rediscover(string *status)
*status+=tmpstr + (i!=backends.begin() ? "\n" : "");
}
- updateDomainCache();
+ updateZoneCache();
}
vector<pair<size_t, SOAData> > bestmatch (backends.size(), make_pair(target.wirelength()+1, SOAData()));
do {
int zoneId{-1};
- if(cachedOk && g_domainCache.isEnabled()) {
- if (g_domainCache.getEntry(shorter, zoneId)) {
- // Zone exists in domain cache, directly look up SOA.
+ if(cachedOk && g_zoneCache.isEnabled()) {
+ if (g_zoneCache.getEntry(shorter, zoneId)) {
+ // Zone exists in zone cache, directly look up SOA.
// XXX: this code path and the cache lookup below should be merged; but that needs the code path below to also use ANY.
// Or it should just also use lookup().
DNSZoneRecord zr;
lookup(QType(QType::SOA), shorter, zoneId, nullptr);
if (!get(zr)) {
- // domain has somehow vanished
- DLOG(g_log << Logger::Info << "Backend returned no SOA for domain '" << shorter.toLogString() << "', which it reported as existing " << endl);
+ // zone has somehow vanished
+ DLOG(g_log << Logger::Info << "Backend returned no SOA for zone '" << shorter.toLogString() << "', which it reported as existing " << endl);
continue;
}
if (zr.dr.d_name != shorter) {
;
goto found;
}
- // domain does not exist, try again with shorter name
+ // zone does not exist, try again with shorter name
continue;
}
bool searchRecords(const string &pattern, int maxResults, vector<DNSResourceRecord>& result);
bool searchComments(const string &pattern, int maxResults, vector<Comment>& result);
- void updateDomainCache();
+ void updateZoneCache();
bool inTransaction();
private:
--config-name=$backend --socket-dir=./ --no-shuffle \
--dnsupdate=yes --resolver=$RESOLVERIP --outgoing-axfr-expand-alias=yes \
--expand-alias=yes \
- --cache-ttl=$cachettl --domain-cache-ttl=$cachettl --dname-processing \
+ --cache-ttl=$cachettl --zone-cache-refresh-interval=$cachettl --dname-processing \
--disable-axfr-rectify=yes $lua_prequery &
if [ $context = ${backend}-nsec3 ]
gsqlite3-database=pdns.sqlite3
consistent-backends
cache-ttl=30
-domain-cache-ttl=30
+zone-cache-refresh-interval=30
direct-dnskey
__EOF__
--query-logging --dnsupdate=yes \
--expand-alias=yes --outgoing-axfr-expand-alias=yes \
--resolver=$RESOLVERIP \
- --domain-cache-ttl=0 \
+ --zone-cache-refresh-interval=0 \
--cache-ttl=$cachettl --dname-processing $lua_prequery &
skipreasons="nodnssec noent nodyndns nometa noaxfr"
cleandig ns1.addzone.com A
cleandig ns1.test.com A
$PDNSCONTROL --config-name=bind --socket-dir=. --no-config bind-add-zone addzone.com ${PWD}/zones/addzone.com >/dev/null 2>&1
-# output of purge changes if domain-cache-ttl is set
+# output of purge changes if zone-cache-refresh-interval is set
$PDNSCONTROL --config-name=bind --socket-dir=. --no-config purge addzone.com >/dev/null
sleep 1
$PDNSCONTROL --config-name=bind --socket-dir=. --no-config bind-add-zone addzone.com ${PWD}/zones/addzone.com