From 0ac228c7153426744ee9cc5ad48b38999eb3118b Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Tue, 25 Sep 2018 17:08:20 +0200 Subject: [PATCH] ixfrdist: add failed-soa-retry configuration option --- docs/manpages/ixfrdist.yml.5.rst | 3 +++ pdns/ixfrdist.cc | 17 ++++++++++++++--- pdns/ixfrdist.example.yml | 5 +++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/docs/manpages/ixfrdist.yml.5.rst b/docs/manpages/ixfrdist.yml.5.rst index 4570fe7c8..3327c1e23 100644 --- a/docs/manpages/ixfrdist.yml.5.rst +++ b/docs/manpages/ixfrdist.yml.5.rst @@ -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. diff --git a/pdns/ixfrdist.cc b/pdns/ixfrdist.cc index ec46456a0..8645e0911 100644 --- a/pdns/ixfrdist.cc +++ b/pdns/ixfrdist.cc @@ -233,7 +233,7 @@ static void updateCurrentZoneInfo(const DNSName& domain, std::shared_ptr 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(); + } catch (const runtime_error &e) { + g_log<(); @@ -1195,7 +1205,8 @@ int main(int argc, char** argv) { std::thread ut(updateThread, config["work-dir"].as(), config["keep"].as(), - config["axfr-timeout"].as()); + config["axfr-timeout"].as(), + config["failed-soa-retry"].as()); vector tcpHandlers; tcpHandlers.reserve(config["tcp-in-threads"].as()); diff --git a/pdns/ixfrdist.example.yml b/pdns/ixfrdist.example.yml index 4a2b8c183..ca5ab5308 100644 --- a/pdns/ixfrdist.example.yml +++ b/pdns/ixfrdist.example.yml @@ -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. # -- 2.40.0