]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add a stats counter for clients dropped due to recursive-clients limit
authorEvan Hunt <each@isc.org>
Tue, 26 Nov 2019 05:28:10 +0000 (21:28 -0800)
committerEvan Hunt <each@isc.org>
Tue, 26 Nov 2019 19:34:23 +0000 (11:34 -0800)
(cherry picked from commit 715afa9c5771ca5b483aad77fe21906685d63889)

CHANGES
bin/named/client.c
bin/named/include/named/server.h
bin/named/statschannel.c
bin/tests/system/fetchlimit/tests.sh

diff --git a/CHANGES b/CHANGES
index c9751295a3929810fe17e65515e15f5ef47dd78e..500ff6c1be81022b67efca4ad02e94194f1fc540 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+5327.  [func]          Added a statistics counter to track queries
+                       dropped because the recursive-clients quota was
+                       exceeded. [GL #1399]
+
 5326.  [bug]           Add python dependancy on 'distutils.core' to configure.
                        'distutils.core' is required for installation.
                        [GL #1397]
index 50fa2cd6c4d6dbff9b78e7303189dc37465094f2..f8431bc36ada09d449e9fea42f7f724efdd347a0 100644 (file)
@@ -286,8 +286,11 @@ ns_client_killoldestquery(ns_client_t *client) {
                ISC_LIST_UNLINK(client->manager->recursing, oldest, rlink);
                UNLOCK(&client->manager->reclock);
                ns_query_cancel(oldest);
-       } else
+               isc_stats_increment(ns_g_server->nsstats,
+                                   dns_nsstatscounter_reclimitdropped);
+       } else {
                UNLOCK(&client->manager->reclock);
+       }
 }
 
 void
index 7ee8f66d28a90d76ca1c1a60e63df9fbaa1d36da..3f96b7b78f865cc7f2a056e451df1bb7075b6450 100644 (file)
@@ -222,7 +222,9 @@ enum {
 
        dns_nsstatscounter_tcphighwater = 57,
 
-       dns_nsstatscounter_max = 58
+       dns_nsstatscounter_reclimitdropped = 58,
+
+       dns_nsstatscounter_max = 59
 };
 
 /*%
index 4cdf7d6fb66e9a2f0743c31be46cfd2e9030ea5e..a243599ab17016b7fdeaa89e5f09174f650e58eb 100644 (file)
@@ -297,6 +297,9 @@ init_desc(void) {
                "QryNXRedirRLookup");
        SET_NSSTATDESC(badcookie, "sent badcookie response", "QryBADCOOKIE");
        SET_NSSTATDESC(keytagopt, "Keytag option received", "KeyTagOpt");
+       SET_NSSTATDESC(reclimitdropped,
+                      "queries dropped due to recursive client limit",
+                      "RecLimitDropped");
        INSIST(i == dns_nsstatscounter_max);
 
        /* Initialize resolver statistics */
index b77ba7bb9e2490cb231958f75aa92afff48b8475..b27d464fbe35cd3e73453b1c82d07a282b32563c 100644 (file)
@@ -179,5 +179,17 @@ echo_i "clients count exceeded 360 on $exceeded trials (expected 0)"
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+echo_i "checking drop statistics"
+rm -f ns3/named.stats
+$RNDCCMD stats
+for try in 1 2 3 4 5; do
+    [ -f ns3/named.stats ] && break
+    sleep 1
+done
+drops=`grep 'queries dropped due to recursive client limit' ns3/named.stats | sed 's/\([0-9][0-9]*\) queries.*/\1/'`
+[ "${drops:-0}" -ne 0 ] || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 echo_i "exit status: $status"
 [ $status -eq 0 ] || exit 1