(unsigned long)s->svr.num_query_authzone_up)) return 0;
if(!ssl_printf(ssl, "num.query.authzone.down"SQ"%lu\n",
(unsigned long)s->svr.num_query_authzone_down)) return 0;
+#ifdef CLIENT_SUBNET
+ if(!ssl_printf(ssl, "num.query.subnet"SQ"%lu\n",
+ (unsigned long)s->svr.num_query_subnet)) return 0;
+ if(!ssl_printf(ssl, "num.query.subnet_cache"SQ"%lu\n",
+ (unsigned long)s->svr.num_query_subnet_cache)) return 0;
+#endif /* CLIENT_SUBNET */
return 1;
}
#include "services/authzone.h"
#include "validator/val_kcache.h"
#include "validator/val_neg.h"
+#ifdef CLIENT_SUBNET
+#include "edns-subnet/subnetmod.h"
+#endif
/** add timers and the values do not overflow or become negative */
static void
(unsigned)worker->env.mesh->stats_jostled);
}
+
+#ifdef CLIENT_SUBNET
+/** Set the EDNS Subnet stats. */
+static void
+set_subnet_stats(struct worker* worker, struct ub_server_stats* svr,
+ int reset)
+{
+ int m = modstack_find(&worker->env.mesh->mods, "subnet");
+ struct subnet_env* sne;
+ if(m == -1)
+ return;
+ sne = (struct subnet_env*)worker->env.modinfo[m];
+ if(reset && !worker->env.cfg->stat_cumulative) {
+ lock_rw_wrlock(&sne->biglock);
+ } else {
+ lock_rw_rdlock(&sne->biglock);
+ }
+ svr->num_query_subnet = (long long)(sne->num_msg_nocache + sne->num_msg_cache);
+ svr->num_query_subnet_cache = (long long)sne->num_msg_cache;
+ if(reset && !worker->env.cfg->stat_cumulative) {
+ sne->num_msg_cache = 0;
+ sne->num_msg_nocache = 0;
+ }
+ lock_rw_unlock(&sne->biglock);
+}
+#endif /* CLIENT_SUBNET */
+
/** Set the neg cache stats. */
static void
set_neg_cache_stats(struct worker* worker, struct ub_server_stats* svr,
/* Set neg cache usage numbers */
set_neg_cache_stats(worker, &s->svr, reset);
+#ifdef CLIENT_SUBNET
+ /* EDNS Subnet usage numbers */
+ set_subnet_stats(worker, &s->svr, reset);
+#else
+ s->svr.num_query_subnet = 0;
+ s->svr.num_query_subnet_cache = 0;
+#endif
/* get tcp accept usage */
s->svr.tcp_accept_usage = 0;
21 August 2018: Wouter
- log-local-actions: yes option for unbound.conf that logs all the
local zone actions, a patch from Saksham Manchanda (Secure64).
+ - #4146: num.query.subnet and num.query.subnet_cache counters.
17 August 2018: Ralph
- Fix classification for QTYPE=CNAME queries when QNAME minimisation is
The number of queries answered using cached NSEC records with NXDOMAIN RCODE.
These queries would otherwise have been sent to the internet, but are now
answered using cached data.
+.TP
+.I num.query.subnet
+Number of queries that got an answer that contained EDNS client subnet data.
+.TP
+.I num.query.subnet_cache
+Number of queries answered from the edns client subnet cache. These are
+counted as cachemiss by the main counters, but hit the client subnet
+specific cache, after getting processed by the edns client subnet module.
.SH "FILES"
.TP
.I @ub_conf_file@
lock_rw_wrlock(&sne->biglock);
update_cache(qstate, id);
+ sne->num_msg_nocache++;
lock_rw_unlock(&sne->biglock);
if (sq->subnet_downstream) {
lock_rw_wrlock(&sne->biglock);
if (lookup_and_reply(qstate, id, sq)) {
+ sne->num_msg_cache++;
lock_rw_unlock(&sne->biglock);
verbose(VERB_QUERY, "subnet: answered from cache");
qstate->ext_state[id] = module_finished;
/** allocation service */
struct alloc_cache alloc;
lock_rw_type biglock;
+ /** number of messages from cache */
+ size_t num_msg_cache;
+ /** number of messages not from cache */
+ size_t num_msg_nocache;
};
struct subnet_msg_cache_data {
/** number of times neg cache records were used to generate NXDOMAIN
* responses. */
long long num_neg_cache_nxdomain;
+ /** number of queries answered from edns-subnet specific data */
+ long long num_query_subnet;
+ /** number of queries answered from edns-subnet specific data, and
+ * the answer was from the edns-subnet cache. */
+ long long num_query_subnet_cache;
};
/**
#endif /* USE_DNSCRYPT */
PR_UL("num.query.authzone.up", s->svr.num_query_authzone_up);
PR_UL("num.query.authzone.down", s->svr.num_query_authzone_down);
+#ifdef CLIENT_SUBNET
+ PR_UL("num.query.subnet", s->svr.num_query_subnet);
+ PR_UL("num.query.subnet_cache", s->svr.num_query_subnet_cache);
+#endif
}
/** print statistics out of memory structures */