diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2018-05-12 11:55:57 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2018-05-12 11:55:57 +0000 |
commit | 2bda7bda432fb0f867072224dd97e10435c8ad94 (patch) | |
tree | 7ebfd82c2302bee4f9c05fb516c030153fb371d8 /daemon | |
parent | a6c5280ea59f940be13fd6eb0f94ab8360d3d6c9 (diff) | |
download | src-2bda7bda432fb0f867072224dd97e10435c8ad94.tar.gz src-2bda7bda432fb0f867072224dd97e10435c8ad94.zip |
Vendor import of Unbound 1.6.7.vendor/unbound/1.6.7
Notes
Notes:
svn path=/vendor/unbound/dist/; revision=333543
svn path=/vendor/unbound/1.6.7/; revision=333544; tag=vendor/unbound/1.6.7
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/remote.c | 11 | ||||
-rw-r--r-- | daemon/stats.c | 23 | ||||
-rw-r--r-- | daemon/unbound.c | 2 | ||||
-rw-r--r-- | daemon/worker.c | 3 |
4 files changed, 36 insertions, 3 deletions
diff --git a/daemon/remote.c b/daemon/remote.c index 243d94c49aa1..3477340ff578 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -827,6 +827,7 @@ print_mem(SSL* ssl, struct worker* worker, struct daemon* daemon) #endif /* USE_IPSECMOD */ #ifdef USE_DNSCRYPT size_t dnscrypt_shared_secret = 0; + size_t dnscrypt_nonce = 0; #endif /* USE_DNSCRYPT */ msg = slabhash_get_mem(daemon->env->msg_cache); rrset = slabhash_get_mem(&daemon->env->rrset_cache->table); @@ -843,6 +844,7 @@ print_mem(SSL* ssl, struct worker* worker, struct daemon* daemon) if(daemon->dnscenv) { dnscrypt_shared_secret = slabhash_get_mem( daemon->dnscenv->shared_secrets_cache); + dnscrypt_nonce = slabhash_get_mem(daemon->dnscenv->nonces_cache); } #endif /* USE_DNSCRYPT */ @@ -868,6 +870,9 @@ print_mem(SSL* ssl, struct worker* worker, struct daemon* daemon) if(!print_longnum(ssl, "mem.cache.dnscrypt_shared_secret"SQ, dnscrypt_shared_secret)) return 0; + if(!print_longnum(ssl, "mem.cache.dnscrypt_nonce"SQ, + dnscrypt_nonce)) + return 0; #endif /* USE_DNSCRYPT */ return 1; } @@ -1058,8 +1063,12 @@ print_ext(SSL* ssl, struct ub_stats_info* s) #ifdef USE_DNSCRYPT if(!ssl_printf(ssl, "dnscrypt_shared_secret.cache.count"SQ"%u\n", (unsigned)s->svr.shared_secret_cache_count)) return 0; + if(!ssl_printf(ssl, "dnscrypt_nonce.cache.count"SQ"%u\n", + (unsigned)s->svr.nonce_cache_count)) return 0; if(!ssl_printf(ssl, "num.query.dnscrypt.shared_secret.cachemiss"SQ"%lu\n", (unsigned long)s->svr.num_query_dnscrypt_secret_missed_cache)) return 0; + if(!ssl_printf(ssl, "num.query.dnscrypt.replay"SQ"%lu\n", + (unsigned long)s->svr.num_query_dnscrypt_replay)) return 0; #endif /* USE_DNSCRYPT */ return 1; } @@ -1771,7 +1780,7 @@ negative_del_rrset(struct lruhash_entry* e, void* arg) struct ub_packed_rrset_key* k = (struct ub_packed_rrset_key*)e->key; struct packed_rrset_data* d = (struct packed_rrset_data*)e->data; /* delete the parentside negative cache rrsets, - * these are namerserver rrsets that failed lookup, rdata empty */ + * these are nameserver rrsets that failed lookup, rdata empty */ if((k->rk.flags & PACKED_RRSET_PARENT_SIDE) && d->count == 1 && d->rrsig_count == 0 && d->rr_len[0] == 0) { d->ttl = inf->expired; diff --git a/daemon/stats.c b/daemon/stats.c index 1058556be7c2..ed788720846a 100644 --- a/daemon/stats.c +++ b/daemon/stats.c @@ -174,6 +174,21 @@ get_dnscrypt_cache_miss(struct worker* worker, int reset) lock_basic_unlock(&de->shared_secrets_cache_lock); return r; } + +/** get the number of replayed queries */ +static size_t +get_dnscrypt_replay(struct worker* worker, int reset) +{ + size_t r; + struct dnsc_env* de = worker->daemon->dnscenv; + + lock_basic_lock(&de->nonces_cache_lock); + r = de->num_query_dnscrypt_replay; + if(reset && !worker->env.cfg->stat_cumulative) + de->num_query_dnscrypt_replay = 0; + lock_basic_unlock(&de->nonces_cache_lock); + return r; +} #endif /* USE_DNSCRYPT */ void @@ -225,13 +240,21 @@ server_stats_compile(struct worker* worker, struct ub_stats_info* s, int reset) (long long)get_dnscrypt_cache_miss(worker, reset); s->svr.shared_secret_cache_count = (long long)count_slabhash_entries( worker->daemon->dnscenv->shared_secrets_cache); + s->svr.nonce_cache_count = (long long)count_slabhash_entries( + worker->daemon->dnscenv->nonces_cache); + s->svr.num_query_dnscrypt_replay = + (long long)get_dnscrypt_replay(worker, reset); } else { s->svr.num_query_dnscrypt_secret_missed_cache = 0; s->svr.shared_secret_cache_count = 0; + s->svr.nonce_cache_count = 0; + s->svr.num_query_dnscrypt_replay = 0; } #else s->svr.num_query_dnscrypt_secret_missed_cache = 0; s->svr.shared_secret_cache_count = 0; + s->svr.nonce_cache_count = 0; + s->svr.num_query_dnscrypt_replay = 0; #endif /* USE_DNSCRYPT */ /* get tcp accept usage */ diff --git a/daemon/unbound.c b/daemon/unbound.c index 070a824d6734..432aa912e681 100644 --- a/daemon/unbound.c +++ b/daemon/unbound.c @@ -400,7 +400,7 @@ detach(void) #endif /* HAVE_DAEMON */ } -/** daemonize, drop user priviliges and chroot if needed */ +/** daemonize, drop user privileges and chroot if needed */ static void perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode, const char** cfgfile, int need_pidfile) diff --git a/daemon/worker.c b/daemon/worker.c index 683f93169117..ac7053abddf3 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -1633,7 +1633,8 @@ worker_init(struct worker* worker, struct config_file *cfg, cfg->use_caps_bits_for_id, worker->ports, worker->numports, cfg->unwanted_threshold, cfg->outgoing_tcp_mss, &worker_alloc_cleanup, worker, - cfg->do_udp, worker->daemon->connect_sslctx, cfg->delay_close, + cfg->do_udp || cfg->udp_upstream_without_downstream, + worker->daemon->connect_sslctx, cfg->delay_close, dtenv); if(!worker->back) { log_err("could not create outgoing sockets"); |