- Resize ratelimit and ip-ratelimit caches if changed on reload.

git-svn-id: file:///svn/unbound/trunk@4787 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2018-07-17 14:42:38 +00:00
parent 330c6e1cb0
commit 7579216922
2 changed files with 9 additions and 1 deletions

View file

@ -4,6 +4,7 @@
in the ssl library.
- Fix that ratelimit and ip-ratelimit are applied after reload of
changed config file.
- Resize ratelimit and ip-ratelimit caches if changed on reload.
16 July 2018: Wouter
- Fix qname minimisation NXDOMAIN validation lookup failures causing

View file

@ -299,8 +299,15 @@ infra_adjust(struct infra_cache* infra, struct config_file* cfg)
infra_ip_ratelimit = cfg->ip_ratelimit;
maxmem = cfg->infra_cache_numhosts * (sizeof(struct infra_key)+
sizeof(struct infra_data)+INFRA_BYTES_NAME);
/* divide cachesize by slabs and multiply by slabs, because if the
* cachesize is not an even multiple of slabs, that is the resulting
* size of the slabhash */
if(maxmem != slabhash_get_size(infra->hosts) ||
cfg->infra_cache_slabs != infra->hosts->size) {
cfg->infra_cache_slabs != infra->hosts->size ||
cfg->ratelimit_slabs != infra->domain_rates->size ||
cfg->ratelimit_size/cfg->ratelimit_slabs*cfg->ratelimit_slabs != slabhash_get_size(infra->domain_rates) ||
cfg->ip_ratelimit_slabs != infra->client_ip_rates->size ||
cfg->ip_ratelimit_size/cfg->ip_ratelimit_slabs*cfg->ip_ratelimit_slabs != slabhash_get_size(infra->client_ip_rates)) {
infra_delete(infra);
infra = infra_create(cfg);
} else {