mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Added option for disabling stale-answer-client-timeout
This commit allows to specify "disabled" or "off" in stale-answer-client-timeout statement. The logic to support this behavior will be added in the subsequent commits. This commit also ensures an upper bound to stale-answer-client-timeout which equals to one second less than 'resolver-query-timeout'.
This commit is contained in:
@@ -4488,7 +4488,19 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
|
||||
obj = NULL;
|
||||
result = named_config_get(maps, "stale-answer-client-timeout", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
view->staleanswerclienttimeout = cfg_obj_asuint32(obj);
|
||||
if (cfg_obj_isstring(obj)) {
|
||||
/*
|
||||
* The only string values available for this option
|
||||
* are "disabled" and "off".
|
||||
* We use (uint32_t) -1 to represent disabled since
|
||||
* a value of zero means that stale data can be used
|
||||
* to promptly answer the query, while an attempt to
|
||||
* refresh the RRset will still be made in background.
|
||||
*/
|
||||
view->staleanswerclienttimeout = (uint32_t)-1;
|
||||
} else {
|
||||
view->staleanswerclienttimeout = cfg_obj_asuint32(obj);
|
||||
}
|
||||
|
||||
obj = NULL;
|
||||
result = named_config_get(maps, "stale-refresh-time", &obj);
|
||||
@@ -4779,6 +4791,27 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
|
||||
query_timeout = cfg_obj_asuint32(obj);
|
||||
dns_resolver_settimeout(view->resolver, query_timeout);
|
||||
|
||||
/*
|
||||
* Adjust stale-answer-client-timeout upper bound
|
||||
* to be resolver-query-timeout - 1s.
|
||||
* This assignment is safe as dns_resolver_settimeout()
|
||||
* ensures that resolver->querytimeout value will be in the
|
||||
* [MINIMUM_QUERY_TIMEOUT, MAXIMUM_QUERY_TIMEOUT] range and
|
||||
* MINIMUM_QUERY_TIMEOUT is > 1000 (in ms).
|
||||
*/
|
||||
if (view->staleanswerclienttimeout != (uint32_t)-1 &&
|
||||
view->staleanswerclienttimeout >
|
||||
(dns_resolver_gettimeout(view->resolver) - 1000))
|
||||
{
|
||||
view->staleanswerclienttimeout =
|
||||
dns_resolver_gettimeout(view->resolver) - 1000;
|
||||
isc_log_write(
|
||||
named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
|
||||
"stale-answer-client-timeout adjusted to %" PRIu32,
|
||||
view->staleanswerclienttimeout);
|
||||
}
|
||||
|
||||
/* Specify whether to use 0-TTL for negative response for SOA query */
|
||||
dns_resolver_setzeronosoattl(view->resolver, zero_no_soattl);
|
||||
|
||||
|
Reference in New Issue
Block a user