CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 396
Description
Hi,
There are a number of statistics counters that relate to the inbound queries sent to Unbound and how they're processed or responded to:
{threadX,total}.num.queries
- number of queries received{threadX,total}.num.cachehits
- number of queries that were successfully answered using a cache lookup{threadX,total}.num.cachemiss
- number of queries that needed recursive processing{threadX,total}.num.recursivereplies
- The number of replies sent to queries that needed recursive processing. Could be smaller than threadX.num.cachemiss if due to timeouts no replies were sent for some queries.
What I would really like and that doesn't seem to be tracked by Unbound is the number of outgoing UDP queries sent by the server. There is an existing counter for TCP queries:
num.query.tcpout
- Number of queries that the Unbound server made using TCP outgoing towards other servers.
But there does not seem to be a UDP equivalent that counts the number of queries made using UDP outgoing towards other servers.
The number of outgoing queries sent by the server can vary due to timeouts/retries or various config options (qname-minimisation
, target-fetch-policy
, harden-referral-path
, whether DNSSEC validation is enabled or not, etc.) and the client-facing counters (num.queries
, num.cachemiss
, etc.) won't really reflect any variations.
I think what I'm looking for would be a counter that gets incremented after a successful UDP send in the randomize_and_send_udp()
function:
unbound/services/outside_network.c
Lines 2116 to 2172 in 3bade62
static int | |
randomize_and_send_udp(struct pending* pend, sldns_buffer* packet, int timeout) | |
{ | |
struct timeval tv; | |
struct outside_network* outnet = pend->sq->outnet; | |
/* select id */ | |
if(!select_id(outnet, pend, packet)) { | |
return 0; | |
} | |
/* select src_if, port */ | |
if(addr_is_ip6(&pend->addr, pend->addrlen)) { | |
if(!select_ifport(outnet, pend, | |
outnet->num_ip6, outnet->ip6_ifs)) | |
return 0; | |
} else { | |
if(!select_ifport(outnet, pend, | |
outnet->num_ip4, outnet->ip4_ifs)) | |
return 0; | |
} | |
log_assert(pend->pc && pend->pc->cp); | |
/* send it over the commlink */ | |
if(!comm_point_send_udp_msg(pend->pc->cp, packet, | |
(struct sockaddr*)&pend->addr, pend->addrlen, outnet->udp_connect)) { | |
portcomm_loweruse(outnet, pend->pc); | |
return 0; | |
} | |
/* system calls to set timeout after sending UDP to make roundtrip | |
smaller. */ | |
#ifndef S_SPLINT_S | |
tv.tv_sec = timeout/1000; | |
tv.tv_usec = (timeout%1000)*1000; | |
#endif | |
comm_timer_set(pend->timer, &tv); | |
#ifdef USE_DNSTAP | |
/* | |
* sending src (local service)/dst (upstream) addresses over DNSTAP | |
* There are no chances to get the src (local service) addr if unbound | |
* is not configured with specific outgoing IP-addresses. So we will | |
* pass 0.0.0.0 (::) to argument for | |
* dt_msg_send_outside_query()/dt_msg_send_outside_response() calls. | |
*/ | |
if(outnet->dtenv && | |
(outnet->dtenv->log_resolver_query_messages || | |
outnet->dtenv->log_forwarder_query_messages)) { | |
log_addr(VERB_ALGO, "from local addr", &pend->pc->pif->addr, pend->pc->pif->addrlen); | |
log_addr(VERB_ALGO, "request to upstream", &pend->addr, pend->addrlen); | |
dt_msg_send_outside_query(outnet->dtenv, &pend->addr, &pend->pc->pif->addr, comm_udp, | |
pend->sq->zone, pend->sq->zonelen, packet); | |
} | |
#endif | |
return 1; | |
} |
Thanks!