]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Implement the ForwardOnlyFail statistics channel counter
authorAram Sargsyan <aram@isc.org>
Thu, 12 Sep 2024 12:34:40 +0000 (12:34 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Mon, 16 Sep 2024 09:31:14 +0000 (09:31 +0000)
The new ForwardOnlyFail statistics channel counter indicates the
number of queries failed due to bad forwarders for 'forward only'
zones.

bin/named/statschannel.c
lib/dns/include/dns/stats.h
lib/dns/resolver.c

index ef1b77f4da448ea799dce1906ac3af85b4776766..56bdea17fa57f75e9ef5272776ebf04001ec7a8e 100644 (file)
@@ -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);
 
index 447ec95277a44aa6af943603d2b2eb83a5632ed8..a08f0802171e5134fbf4f26af392d65270bcfb41 100644 (file)
@@ -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.
index f8d5cdc430d8cfb48aa0982553709c9066ef3b6e..e64d6693af34f4ae52b6bfb45ce02dbdc1e25365 100644 (file)
@@ -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 {
                /*