diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c index ef1b77f4da..56bdea17fa 100644 --- a/bin/named/statschannel.c +++ b/bin/named/statschannel.c @@ -472,6 +472,8 @@ init_desc(void) { "ClientQuota"); SET_RESSTATDESC(nextitem, "waited for next item", "NextItem"); SET_RESSTATDESC(priming, "priming queries", "Priming"); + SET_RESSTATDESC(forwardonlyfail, "all forwarders failed", + "ForwardOnlyFail"); INSIST(i == dns_resstatscounter_max); diff --git a/bin/tests/system/forward/tests.sh b/bin/tests/system/forward/tests.sh index 7a31febb25..f2d4c827b1 100644 --- a/bin/tests/system/forward/tests.sh +++ b/bin/tests/system/forward/tests.sh @@ -166,10 +166,11 @@ status=$((status + ret)) # GL#1793 n=$((n + 1)) -echo_i "checking that the 'serverquota' counter isn't increased because of the SERVFAIL in the previous check ($n)" +echo_i "checking that the correct counter is increased because of the SERVFAIL in the previous check ($n)" ret=0 "${CURL}" "http://10.53.0.4:${EXTRAPORT1}/json/v1" 2>/dev/null >statschannel.out.$n -grep -F "ServerQuota" statschannel.out.$n >/dev/null && ret=1 +grep -F '"ServerQuota"' statschannel.out.$n >/dev/null && ret=1 +grep -F '"ForwardOnlyFail":1' statschannel.out.$n >/dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) diff --git a/doc/arm/reference.rst b/doc/arm/reference.rst index 6767d9076a..3543e1448c 100644 --- a/doc/arm/reference.rst +++ b/doc/arm/reference.rst @@ -8236,6 +8236,9 @@ Resolver Statistics Counters ``ClientQuota`` This indicates the number of queries spilled for exceeding the :any:`clients-per-query` quota. +``ForwardOnlyFail`` + This indicates the number of queries failed due to bad forwarders for ``forward only`` zones. + ``NextItem`` This indicates the number of times the server waited for the next item after receiving an invalid response. diff --git a/lib/dns/include/dns/stats.h b/lib/dns/include/dns/stats.h index 447ec95277..a08f080217 100644 --- a/lib/dns/include/dns/stats.h +++ b/lib/dns/include/dns/stats.h @@ -74,7 +74,8 @@ enum { dns_resstatscounter_clientquota = 43, dns_resstatscounter_nextitem = 44, dns_resstatscounter_priming = 45, - dns_resstatscounter_max = 46, + dns_resstatscounter_forwardonlyfail = 46, + dns_resstatscounter_max = 47, /* * DNSSEC stats. diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index f8d5cdc430..e64d6693af 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -3715,13 +3715,23 @@ out: /* * If all of the addresses found were over the - * fetches-per-server quota, return the - * configured response. + * fetches-per-server quota, increase the ServerQuota + * counter and return the configured response. */ if (all_spilled) { result = res->quotaresp[dns_quotatype_server]; inc_stats(res, dns_resstatscounter_serverquota); } + + /* + * If we are using a 'forward only' policy, and all + * the forwarders are bad, increase the ForwardOnlyFail + * counter. + */ + if (fctx->fwdpolicy == dns_fwdpolicy_only) { + inc_stats(res, + dns_resstatscounter_forwardonlyfail); + } } } else { /*