]> granicus.if.org Git - pdns/commitdiff
ixfrdist: add failed-soa-retry configuration option
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Tue, 25 Sep 2018 15:08:20 +0000 (17:08 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Tue, 25 Sep 2018 15:09:12 +0000 (17:09 +0200)
docs/manpages/ixfrdist.yml.5.rst
pdns/ixfrdist.cc
pdns/ixfrdist.example.yml

index 4570fe7c82e0c155d8dda6675ce92a4b28a6cf07..3327c1e239916d6d9ed61bf4a48236dccf507430 100644 (file)
@@ -59,6 +59,9 @@ Options
   Increase this when the network to the authoritative servers is slow or the domains are very large and you experience timeouts.
   Defaults to 20.
 
+:failed-soa-retry:
+  Time in seconds between retries of the SOA query for a zone we have never transferred. Defaults to 30.
+
 :compress:
   Whether record compression should be enabled, leading to smaller answers at the cost of an increased CPU and memory usage.
   Defaults to false.
index ec46456a08d7e45a0aecf9bb3ef71f8b3caf64cf..8645e091144098b7e5d4f0167c804cd9cf05a2cc 100644 (file)
@@ -233,7 +233,7 @@ static void updateCurrentZoneInfo(const DNSName& domain, std::shared_ptr<ixfrinf
   g_soas[domain] = newInfo;
 }
 
-void updateThread(const string& workdir, const uint16_t& keep, const uint16_t& axfrTimeout) {
+void updateThread(const string& workdir, const uint16_t& keep, const uint16_t& axfrTimeout, const uint16_t& soaRetry) {
   std::map<DNSName, time_t> lastCheck;
 
   // Initialize the serials we have
@@ -296,7 +296,7 @@ void updateThread(const string& workdir, const uint16_t& keep, const uint16_t& a
 
       auto& zoneLastCheck = lastCheck[domain];
       if ((current_soa != nullptr && now - zoneLastCheck < current_soa->d_st.refresh) || // Only check if we have waited `refresh` seconds
-          (current_soa == nullptr && now - zoneLastCheck < 30))  {                       // Or if we could not get an update at all still, every 30 seconds
+          (current_soa == nullptr && now - zoneLastCheck < soaRetry))  {                       // Or if we could not get an update at all still, every 30 seconds
         continue;
       }
 
@@ -904,6 +904,16 @@ static bool parseAndCheckConfig(const string& configpath, YAML::Node& config) {
     config["axfr-timeout"] = 20;
   }
 
+  if (config["failed-soa-retry"]) {
+    try {
+      config["failed-soa-retry"].as<uint16_t>();
+    } catch (const runtime_error &e) {
+      g_log<<Logger::Error<<"Unable to read 'failed-soa-retry' value: "<<e.what()<<endl;
+    }
+  } else {
+    config["failed-soa-retry"] = 30;
+  }
+
   if (config["tcp-in-threads"]) {
     try {
       config["tcp-in-threads"].as<uint16_t>();
@@ -1195,7 +1205,8 @@ int main(int argc, char** argv) {
   std::thread ut(updateThread,
       config["work-dir"].as<string>(),
       config["keep"].as<uint16_t>(),
-      config["axfr-timeout"].as<uint16_t>());
+      config["axfr-timeout"].as<uint16_t>(),
+      config["failed-soa-retry"].as<uint16_t>());
 
   vector<std::thread> tcpHandlers;
   tcpHandlers.reserve(config["tcp-in-threads"].as<uint16_t>());
index 4a2b8c1833e23f3cf735cd8c19afe06cd3ce32c4..ca5ab53087a1ec183e87ae63b3d02bd956c4490d 100644 (file)
@@ -35,6 +35,11 @@ acl:
 #
 axfr-timeout: 20
 
+# Time in seconds between retries of the SOA query for a zone we have never
+# transferred.
+
+failed-soa-retry: 30
+
 # Whether record compression should be enabled, leading to smaller answers
 # at the cost of an increased CPU and memory usage. Defaults to false.
 #