// Why a struct? This way we can add more options to a domain in the future
struct ixfrdistdomain_t {
set<ComboAddress> masters; // A set so we can do multiple master addresses in the future
+ uint32_t maxSOARefresh{0}; // Cap SOA refresh value to the given value in seconds
};
// This contains the configuration for each domain
}
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 < soaRetry)) { // Or if we could not get an update at all still, every 30 seconds
+ uint32_t refresh = soaRetry; // default if we don't get an update at all
+ if (current_soa != nullptr) {
+ // Check every `refresh` seconds as advertised in the SOA record
+ refresh = current_soa->d_st.refresh;
+ if (domainConfig.second.maxSOARefresh > 0) {
+ // Cap refresh value to the configured one if any
+ refresh = std::min(refresh, domainConfig.second.maxSOARefresh);
+ }
+ }
+ if (now - zoneLastCheck < refresh) {
continue;
}
g_log<<Logger::Error<<"Unable to read domain '"<<domain["domain"].as<string>()<<"' master address: "<<e.what()<<endl;
retval = false;
}
+ if (domain["max-soa-refresh"]) {
+ try {
+ config["max-soa-refresh"].as<uint32_t>();
+ } catch (const runtime_error &e) {
+ g_log<<Logger::Error<<"Unable to read 'max-soa-refresh' value for domain '"<<domain["domain"].as<string>()<<"': "<<e.what()<<endl;
+ }
+ }
}
} else {
g_log<<Logger::Error<<"No domains configured"<<endl;
set<ComboAddress> s;
s.insert(domain["master"].as<ComboAddress>());
g_domainConfigs[domain["domain"].as<DNSName>()].masters = s;
+ if (domain["max-soa-refresh"]) {
+ g_domainConfigs[domain["domain"].as<DNSName>()].maxSOARefresh = domain["max-soa-refresh"].as<uint32_t>();
+ }
g_stats.registerDomain(domain["domain"].as<DNSName>());
}
# When no port is specified, 53 is used. When specifying ports for IPv6, use the
# "bracket" notation:
#
+# You can optionally cap the refresh time of the SOA using 'max-soa-refresh' (seconds)
+# Otherwise, or if set to 0, the retreived SOA refresh time will be used
+#
# domains:
# - domain: example.com
# master: 192.0.2.15
+# max-soa-refresh: 180
# - domain: rpz.example
# master: [2001:DB8:a34:543::53]:5353
#