From: Otto Date: Wed, 29 Sep 2021 14:36:42 +0000 (+0200) Subject: Current code doesn't care if dnssec is enabled or not; reorder struct Config X-Git-Tag: auth-4.6.0-alpha1~5^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bdde96ff6a642de2dd5cbd0de121cd40cde0d840;p=thirdparty%2Fpdns.git Current code doesn't care if dnssec is enabled or not; reorder struct Config --- diff --git a/pdns/recursordist/rec-zonetocache.cc b/pdns/recursordist/rec-zonetocache.cc index 9e4a4899be..053ddbcb56 100644 --- a/pdns/recursordist/rec-zonetocache.cc +++ b/pdns/recursordist/rec-zonetocache.cc @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include #include "rec-zonetocache.hh" #include "syncres.hh" @@ -37,17 +38,10 @@ time_t RecZoneToCache::ZonesToCache(const std::vector& cfgs) // By default and max once per 24 hours time_t refresh = 24 * 3600; - struct timeval now; - gettimeofday(&now, nullptr); - SyncRes sr(now); - bool dnssec = g_dnssecmode != DNSSECMode::Off; - sr.setDoDNSSEC(dnssec); - sr.setDNSSECValidationRequested(g_dnssecmode != DNSSECMode::Off && g_dnssecmode != DNSSECMode::ProcessNoValidate); - for (const auto& config : cfgs) { const string msg = "zones-to-cache error while loading " + config.d_zone + ": "; try { - refresh = min(refresh, ZoneToCache(config, dnssec)); + refresh = std::min(refresh, ZoneToCache(config)); } catch (const PDNSException& e) { g_log << Logger::Error << msg << e.reason << endl; @@ -60,7 +54,7 @@ time_t RecZoneToCache::ZonesToCache(const std::vector& cfgs) } // We do not want to refresh more than once per hour - refresh = std::max(refresh, 3600LL); + refresh = std::max(refresh, static_cast(3600)); } return refresh; @@ -103,7 +97,7 @@ void ZoneData::parseDRForCache(DNSRecord& dr) { const auto key = make_pair(dr.d_name, dr.d_type); - d_refresh = min(d_refresh, static_cast(dr.d_ttl)); + d_refresh = std::min(d_refresh, static_cast(dr.d_ttl)); dr.d_ttl += d_now; switch (dr.d_type) { @@ -202,7 +196,7 @@ static std::vector getURL(const RecZoneToCache::Config& config) return lines; } -time_t RecZoneToCache::ZoneToCache(const Config& config, bool dnssec) +time_t RecZoneToCache::ZoneToCache(const Config& config) { if (config.d_sources.size() > 1) { // XXX Warning diff --git a/pdns/recursordist/rec-zonetocache.hh b/pdns/recursordist/rec-zonetocache.hh index d95891e955..8d80913e56 100644 --- a/pdns/recursordist/rec-zonetocache.hh +++ b/pdns/recursordist/rec-zonetocache.hh @@ -34,13 +34,13 @@ public: std::string d_zone; // Zone name std::string d_method; // axfr, http, https, file vector d_sources; // IPs or URLs - uint32_t d_timeout{20}; // timeout in seconds ComboAddress d_local; // local address - size_t d_maxReceivedBytes{0}; // Maximum size TSIGTriplet d_tt; // Authentication data + size_t d_maxReceivedBytes{0}; // Maximum size + uint32_t d_timeout{20}; // timeout in seconds }; static time_t ZonesToCache(const std::vector&); private: - static time_t ZoneToCache(const Config& config, bool dnssec); + static time_t ZoneToCache(const Config& config); };