mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-21 07:10:43 -05:00
- Fix #1217: Add metrics to unbound-control interface showing
crypted, cert request, plaintext and malformed queries (from Manu Bretelle). git-svn-id: file:///svn/unbound/trunk@4084 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
e56c63172c
commit
897635b32b
7 changed files with 46 additions and 1 deletions
|
|
@ -798,6 +798,16 @@ print_stats(SSL* ssl, const char* nm, struct stats_info* s)
|
||||||
(unsigned long)s->svr.zero_ttl_responses)) return 0;
|
(unsigned long)s->svr.zero_ttl_responses)) return 0;
|
||||||
if(!ssl_printf(ssl, "%s.num.recursivereplies"SQ"%lu\n", nm,
|
if(!ssl_printf(ssl, "%s.num.recursivereplies"SQ"%lu\n", nm,
|
||||||
(unsigned long)s->mesh_replies_sent)) return 0;
|
(unsigned long)s->mesh_replies_sent)) return 0;
|
||||||
|
#ifdef USE_DNSCRYPT
|
||||||
|
if(!ssl_printf(ssl, "%s.num.dnscrypt.crypted"SQ"%lu\n", nm,
|
||||||
|
(unsigned long)s->svr.num_query_dnscrypt_crypted)) return 0;
|
||||||
|
if(!ssl_printf(ssl, "%s.num.dnscrypt.cert"SQ"%lu\n", nm,
|
||||||
|
(unsigned long)s->svr.num_query_dnscrypt_cert)) return 0;
|
||||||
|
if(!ssl_printf(ssl, "%s.num.dnscrypt.cleartext"SQ"%lu\n", nm,
|
||||||
|
(unsigned long)s->svr.num_query_dnscrypt_cleartext)) return 0;
|
||||||
|
if(!ssl_printf(ssl, "%s.num.dnscrypt.malformed"SQ"%lu\n", nm,
|
||||||
|
(unsigned long)s->svr.num_query_dnscrypt_crypted_malformed)) return 0;
|
||||||
|
#endif
|
||||||
if(!ssl_printf(ssl, "%s.requestlist.avg"SQ"%g\n", nm,
|
if(!ssl_printf(ssl, "%s.requestlist.avg"SQ"%g\n", nm,
|
||||||
(s->svr.num_queries_missed_cache+s->svr.num_queries_prefetch)?
|
(s->svr.num_queries_missed_cache+s->svr.num_queries_prefetch)?
|
||||||
(double)s->svr.sum_query_list_size/
|
(double)s->svr.sum_query_list_size/
|
||||||
|
|
|
||||||
|
|
@ -232,6 +232,14 @@ void server_stats_add(struct stats_info* total, struct stats_info* a)
|
||||||
total->svr.num_queries_missed_cache += a->svr.num_queries_missed_cache;
|
total->svr.num_queries_missed_cache += a->svr.num_queries_missed_cache;
|
||||||
total->svr.num_queries_prefetch += a->svr.num_queries_prefetch;
|
total->svr.num_queries_prefetch += a->svr.num_queries_prefetch;
|
||||||
total->svr.sum_query_list_size += a->svr.sum_query_list_size;
|
total->svr.sum_query_list_size += a->svr.sum_query_list_size;
|
||||||
|
#ifdef USE_DNSCRYPT
|
||||||
|
total->svr.num_query_dnscrypt_crypted += a->svr.num_query_dnscrypt_crypted;
|
||||||
|
total->svr.num_query_dnscrypt_cert += a->svr.num_query_dnscrypt_cert;
|
||||||
|
total->svr.num_query_dnscrypt_cleartext += \
|
||||||
|
a->svr.num_query_dnscrypt_cleartext;
|
||||||
|
total->svr.num_query_dnscrypt_crypted_malformed += \
|
||||||
|
a->svr.num_query_dnscrypt_crypted_malformed;
|
||||||
|
#endif
|
||||||
/* the max size reached is upped to higher of both */
|
/* the max size reached is upped to higher of both */
|
||||||
if(a->svr.max_query_list_size > total->svr.max_query_list_size)
|
if(a->svr.max_query_list_size > total->svr.max_query_list_size)
|
||||||
total->svr.max_query_list_size = a->svr.max_query_list_size;
|
total->svr.max_query_list_size = a->svr.max_query_list_size;
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
#ifndef DAEMON_STATS_H
|
#ifndef DAEMON_STATS_H
|
||||||
#define DAEMON_STATS_H
|
#define DAEMON_STATS_H
|
||||||
#include "util/timehist.h"
|
#include "util/timehist.h"
|
||||||
|
#include "dnscrypt/dnscrypt_config.h"
|
||||||
struct worker;
|
struct worker;
|
||||||
struct config_file;
|
struct config_file;
|
||||||
struct comm_point;
|
struct comm_point;
|
||||||
|
|
@ -149,6 +150,16 @@ struct server_stats {
|
||||||
size_t infra_cache_count;
|
size_t infra_cache_count;
|
||||||
/** number of key cache entries */
|
/** number of key cache entries */
|
||||||
size_t key_cache_count;
|
size_t key_cache_count;
|
||||||
|
#ifdef USE_DNSCRYPT
|
||||||
|
/** number of queries that used dnscrypt */
|
||||||
|
size_t num_query_dnscrypt_crypted;
|
||||||
|
/** number of queries that queried dnscrypt certificates */
|
||||||
|
size_t num_query_dnscrypt_cert;
|
||||||
|
/** number of queries in clear text and not asking for the certificates */
|
||||||
|
size_t num_query_dnscrypt_cleartext;
|
||||||
|
/** number of malformed encrypted queries */
|
||||||
|
size_t num_query_dnscrypt_crypted_malformed;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -977,6 +977,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
||||||
#ifdef USE_DNSCRYPT
|
#ifdef USE_DNSCRYPT
|
||||||
repinfo->max_udp_size = worker->daemon->cfg->max_udp_size;
|
repinfo->max_udp_size = worker->daemon->cfg->max_udp_size;
|
||||||
if(!dnsc_handle_curved_request(worker->daemon->dnscenv, repinfo)) {
|
if(!dnsc_handle_curved_request(worker->daemon->dnscenv, repinfo)) {
|
||||||
|
worker->stats.num_query_dnscrypt_crypted_malformed++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(c->dnscrypt && !repinfo->is_dnscrypted) {
|
if(c->dnscrypt && !repinfo->is_dnscrypted) {
|
||||||
|
|
@ -1003,9 +1004,13 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
||||||
sldns_rr_descript(qinfo.qtype)->_name,
|
sldns_rr_descript(qinfo.qtype)->_name,
|
||||||
buf);
|
buf);
|
||||||
comm_point_drop_reply(repinfo);
|
comm_point_drop_reply(repinfo);
|
||||||
|
worker->stats.num_query_dnscrypt_cleartext++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
worker->stats.num_query_dnscrypt_cert++;
|
||||||
sldns_buffer_rewind(c->buffer);
|
sldns_buffer_rewind(c->buffer);
|
||||||
|
} else if(c->dnscrypt && repinfo->is_dnscrypted) {
|
||||||
|
worker->stats.num_query_dnscrypt_crypted++;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_DNSTAP
|
#ifdef USE_DNSTAP
|
||||||
|
|
|
||||||
|
|
@ -468,7 +468,6 @@ dnsc_handle_curved_request(struct dnsc_env* dnscenv,
|
||||||
repinfo->client_nonce,
|
repinfo->client_nonce,
|
||||||
repinfo->nmkey,
|
repinfo->nmkey,
|
||||||
c->buffer) != 0){
|
c->buffer) != 0){
|
||||||
// TODO: Bump counter!
|
|
||||||
verbose(VERB_ALGO, "dnscrypt: Failed to uncurve");
|
verbose(VERB_ALGO, "dnscrypt: Failed to uncurve");
|
||||||
comm_point_drop_reply(repinfo);
|
comm_point_drop_reply(repinfo);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
3 April 2017: Wouter
|
||||||
|
- Fix #1217: Add metrics to unbound-control interface showing
|
||||||
|
crypted, cert request, plaintext and malformed queries (from
|
||||||
|
Manu Bretelle).
|
||||||
|
|
||||||
27 March 2017: Wouter
|
27 March 2017: Wouter
|
||||||
- Remove (now unused) event2 include from dnscrypt code.
|
- Remove (now unused) event2 include from dnscrypt code.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,13 @@ static void pr_stats(const char* nm, struct stats_info* s)
|
||||||
PR_UL_NM("num.prefetch", s->svr.num_queries_prefetch);
|
PR_UL_NM("num.prefetch", s->svr.num_queries_prefetch);
|
||||||
PR_UL_NM("num.zero_ttl", s->svr.zero_ttl_responses);
|
PR_UL_NM("num.zero_ttl", s->svr.zero_ttl_responses);
|
||||||
PR_UL_NM("num.recursivereplies", s->mesh_replies_sent);
|
PR_UL_NM("num.recursivereplies", s->mesh_replies_sent);
|
||||||
|
#ifdef USE_DNSCRYPT
|
||||||
|
PR_UL_NM("num.dnscrypt.crypted", s->svr.num_query_dnscrypt_crypted);
|
||||||
|
PR_UL_NM("num.dnscrypt.cert", s->svr.num_query_dnscrypt_cert);
|
||||||
|
PR_UL_NM("num.dnscrypt.cleartext", s->svr.num_query_dnscrypt_cleartext);
|
||||||
|
PR_UL_NM("num.dnscrypt.malformed",
|
||||||
|
s->svr.num_query_dnscrypt_crypted_malformed);
|
||||||
|
#endif
|
||||||
printf("%s.requestlist.avg"SQ"%g\n", nm,
|
printf("%s.requestlist.avg"SQ"%g\n", nm,
|
||||||
(s->svr.num_queries_missed_cache+s->svr.num_queries_prefetch)?
|
(s->svr.num_queries_missed_cache+s->svr.num_queries_prefetch)?
|
||||||
(double)s->svr.sum_query_list_size/
|
(double)s->svr.sum_query_list_size/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue