2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Check 'stale-refresh-time' when sharing cache between views

This commit ensures that, along with previous restrictions, a cache is
shareable between views only if their 'stale-refresh-time' value are
equal.
This commit is contained in:
Diego Fronza
2020-11-10 13:50:54 -03:00
parent e99671e8dd
commit 581e2a8f28
3 changed files with 31 additions and 4 deletions

View File

@@ -142,6 +142,7 @@ struct dns_cache {
char **db_argv;
size_t size;
dns_ttl_t serve_stale_ttl;
dns_ttl_t serve_stale_refresh;
isc_stats_t *stats;
/* Locked by 'filelock'. */
@@ -1000,12 +1001,27 @@ dns_cache_getservestalettl(dns_cache_t *cache) {
}
void
dns_cache_setservestalerefresh(dns_cache_t *cache, uint32_t interval) {
dns_cache_setservestalerefresh(dns_cache_t *cache, dns_ttl_t interval) {
REQUIRE(VALID_CACHE(cache));
LOCK(&cache->lock);
cache->serve_stale_refresh = interval;
UNLOCK(&cache->lock);
(void)dns_db_setservestalerefresh(cache->db, interval);
}
dns_ttl_t
dns_cache_getservestalerefresh(dns_cache_t *cache) {
isc_result_t result;
dns_ttl_t interval;
REQUIRE(VALID_CACHE(cache));
result = dns_db_getservestalerefresh(cache->db, &interval);
return (result == ISC_R_SUCCESS ? interval : 0);
}
/*
* The cleaner task is shutting down; do the necessary cleanup.
*/