]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: Add rec_control getters for dont-throttle-*
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 13 Feb 2019 10:07:43 +0000 (11:07 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Mon, 18 Feb 2019 17:43:28 +0000 (18:43 +0100)
pdns/rec_channel.hh
pdns/rec_channel_rec.cc

index 0f1dd7973e7f4413000ff1e20b1f1aaf11fc1e2f..8f590340a8ccd9142a088a28cf06ca47039829f9 100644 (file)
 #include <pthread.h>
 #include "iputils.hh"
 #include "dnsname.hh"
+#include "sholder.hh"
 #include <atomic>
 
+extern GlobalStateHolder<SuffixMatchNode> g_dontThrottleNames;
+extern GlobalStateHolder<NetmaskGroup> g_dontThrottleNetmasks;
+
 /** this class is used both to send and answer channel commands to the PowerDNS Recursor */
 class RecursorControlChannel
 {
index 0259c6875832a926e240e8f58c16b257765ff087..a7fdab2ec712d4591289238b1b95f185ce3bac42 100644 (file)
@@ -1288,6 +1288,16 @@ static string* nopFunction()
   return new string("pong\n");
 }
 
+string getDontThrottleNames() {
+  auto dtn = g_dontThrottleNames.getLocal();
+  return dtn->toString() + "\n";
+}
+
+string getDontThrottleNetmasks() {
+  auto dtn = g_dontThrottleNetmasks.getLocal();
+  return dtn->toString() + "\n";
+}
+
 string RecursorControlParser::getAnswer(const string& question, RecursorControlParser::func_t** command)
 {
   *command=nop;
@@ -1315,6 +1325,8 @@ string RecursorControlParser::getAnswer(const string& question, RecursorControlP
 "dump-throttlemap <filename>      dump the contents of the throttle to the named file\n"
 "get [key1] [key2] ..             get specific statistics\n"
 "get-all                          get all statistics\n"
+"get-dont-throttle-names          get the list of names that are not allowed to be throttled\n"
+"get-dont-throttle-netmasks       get the list of netmasks that are not allowed to be throttled\n"
 "get-ntas                         get all configured Negative Trust Anchors\n"
 "get-tas                          get all configured Trust Anchors\n"
 "get-parameter [key1] [key2] ..   get configuration parameters\n"
@@ -1540,5 +1552,13 @@ string RecursorControlParser::getAnswer(const string& question, RecursorControlP
   if (cmd=="set-dnssec-log-bogus")
     return doSetDnssecLogBogus(begin, end);
 
+  if (cmd == "get-dont-throttle-names") {
+    return getDontThrottleNames();
+  }
+
+  if (cmd == "get-dont-throttle-netmasks") {
+    return getDontThrottleNetmasks();
+  }
+
   return "Unknown command '"+cmd+"', try 'help'\n";
 }