]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Resize ratelimit and ip-ratelimit caches if changed on reload.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 17 Jul 2018 14:42:38 +0000 (14:42 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 17 Jul 2018 14:42:38 +0000 (14:42 +0000)
git-svn-id: file:///svn/unbound/trunk@4787 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
services/cache/infra.c

index 3461722b43a3bd2f5b72317cd33d2b618540141c..4b3b61c395d79b0662b1ca87f0ecfcc5d5d02c7a 100644 (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
index 59f2eba8969d683058e7386a33411fff8427c7ed..a755e32de499c359bd8b050b4641808b0e98b94e 100644 (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 {