- Small fixes for the shared secret cache patch.

git-svn-id: file:///svn/unbound/trunk@4313 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2017-08-28 11:05:51 +00:00
parent e3cc298ffd
commit 9a44fc5142
2 changed files with 5 additions and 3 deletions

View file

@ -55,7 +55,7 @@
struct shared_secret_cache_key { struct shared_secret_cache_key {
/** the hash table key */ /** the hash table key */
uint8_t key[DNSCRYPT_SHARED_SECRET_KEY_LENGTH]; uint8_t key[DNSCRYPT_SHARED_SECRET_KEY_LENGTH];
/** the hash table entry, data is struct reply_info* */ /** the hash table entry, data is uint8_t pointer of size crypto_box_BEFORENMBYTES which contains the shared secret. */
struct lruhash_entry entry; struct lruhash_entry entry;
}; };
@ -786,7 +786,7 @@ dnsc_apply_cfg(struct dnsc_env *env, struct config_file *cfg)
env->shared_secrets_cache = slabhash_create( env->shared_secrets_cache = slabhash_create(
cfg->msg_cache_slabs, cfg->msg_cache_slabs,
HASH_DEFAULT_STARTARRAY, HASH_DEFAULT_STARTARRAY,
cfg->msg_cache_size, 4000000,
dnsc_shared_secrets_sizefunc, dnsc_shared_secrets_sizefunc,
dnsc_shared_secrets_compfunc, dnsc_shared_secrets_compfunc,
dnsc_shared_secrets_delkeyfunc, dnsc_shared_secrets_delkeyfunc,
@ -820,12 +820,13 @@ dnsc_delete(struct dnsc_env *env)
*/ */
size_t size_t
dnsc_shared_secrets_sizefunc(void *k, void *d) dnsc_shared_secrets_sizefunc(void *k, void* ATTR_UNUSED(d))
{ {
struct shared_secret_cache_key* ssk = (struct shared_secret_cache_key*)k; struct shared_secret_cache_key* ssk = (struct shared_secret_cache_key*)k;
size_t key_size = sizeof(struct shared_secret_cache_key) size_t key_size = sizeof(struct shared_secret_cache_key)
+ lock_get_mem(&ssk->entry.lock); + lock_get_mem(&ssk->entry.lock);
size_t data_size = crypto_box_BEFORENMBYTES; size_t data_size = crypto_box_BEFORENMBYTES;
(void)ssk; /* otherwise ssk is unused if no threading, or fixed locksize */
return key_size + data_size; return key_size + data_size;
} }

View file

@ -3,6 +3,7 @@
- iana portlist update - iana portlist update
- Fix #1415: [dnscrypt] shared secret cache, patch from - Fix #1415: [dnscrypt] shared secret cache, patch from
Manu Bretelle. Manu Bretelle.
- Small fixes for the shared secret cache patch.
23 August 2017: Wouter 23 August 2017: Wouter
- Fix #1407: Add ECS options check to unbound-checkconf. - Fix #1407: Add ECS options check to unbound-checkconf.