lmdb-mapsize 32M;\n\
max-cache-size default;\n\
max-cache-ttl 604800; /* 1 week */\n\
+ max-delegation-ttl 0; /* disabled */\n\
max-clients-per-query 100;\n\
max-delegation-servers 13;\n\
max-ncache-ttl 10800; /* 3 hours */\n\
message-compression yes;\n\
min-ncache-ttl 0; /* 0 hours */\n\
min-cache-ttl 0; /* 0 seconds */\n\
+ min-delegation-ttl 60; /* 1 minute */\n\
minimal-any yes;\n\
minimal-responses no-auth-recursive;\n\
notify-source *;\n\
}
}
+static isc_result_t
+configure_view_delegdb(const cfg_obj_t **maps, dns_view_t *pview,
+ dns_view_t *view, size_t cachesz) {
+ isc_result_t result;
+ const cfg_obj_t *obj;
+ uint32_t minttl, maxttl;
+
+ /*
+ * The deleg DB cache is preserved if reconfiguring/reloading the
+ * server.
+ */
+ if (pview != NULL) {
+ dns_delegdb_attach(pview->deleg, &view->deleg);
+ } else {
+ dns_delegdb_create(&view->deleg);
+ }
+
+ obj = NULL;
+ result = named_config_get(maps, "min-delegation-ttl", &obj);
+ INSIST(result == ISC_R_SUCCESS);
+ minttl = cfg_obj_asduration(obj);
+
+ obj = NULL;
+ result = named_config_get(maps, "max-delegation-ttl", &obj);
+ INSIST(result == ISC_R_SUCCESS);
+ maxttl = cfg_obj_asduration(obj);
+
+ if (minttl != 0 && maxttl != 0 && minttl >= maxttl) {
+ isc_log_write(
+ NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER,
+ ISC_LOG_ERROR,
+ "When 'min-delegation-ttl' and 'max-delegation-ttl' "
+ "are both positive, 'min-delegation-ttl' must be "
+ "strictly less than 'max-delegation-ttl'");
+ result = ISC_R_RANGE;
+ } else {
+ dns_delegdb_config_t config = { .dbsize = cachesz,
+ .minttl = minttl,
+ .maxttl = maxttl };
+ dns_delegdb_setconfig(view->deleg, &config);
+ }
+
+ return result;
+}
+
static const char *const response_synonyms[] = { "response", NULL };
/*
dispatch4, dispatch6));
/*
- * The deleg DB cache is preserved if reconfiguring/reloading the
- * server.
- */
- if (pview != NULL) {
- dns_delegdb_attach(pview->deleg, &view->deleg);
- } else {
- dns_delegdb_create(&view->deleg);
- }
- dns_delegdb_setconfig(
- view->deleg,
- &(dns_delegdb_config_t){ .dbsize = cache_size_slice });
-
- /*
- * The previous view isn't needed anymore.
+ * Configure delegdb and detatch the previous viw which isn't needed
+ * afterwards.
*/
+ result = configure_view_delegdb(maps, pview, view, cache_size_slice);
if (pview != NULL) {
dns_view_detach(&pview);
}
+ CHECK(result);
if (resstats == NULL) {
isc_stats_create(mctx, &resstats, dns_resstatscounter_max);
disable-empty-zone 127.IN-ADDR.ARPA;
recursion yes;
dnssec-validation no;
+
+ // lame-and-expire-soon domain NS has a TTL of 2 seconds,
+ // so let's use a lower value here.
+ min-delegation-ttl 1;
};
--- /dev/null
+options {
+ min-delegation-ttl "0";
+};
--- /dev/null
+options {
+ min-delegation-ttl 6;
+ max-delegation-ttl 5;
+};
--- /dev/null
+options {
+ min-delegation-ttl 50;
+ max-delegation-ttl 60;
+};
+
+view foo {
+ min-delegation-ttl 4;
+ max-delegation-ttl 5;
+};
--- /dev/null
+options {
+ min-delegation-ttl 50;
+ max-delegation-ttl 0;
+};
+
+view foo {
+ min-delegation-ttl 4;
+ max-delegation-ttl 0;
+};
dnssec-validation no;
disable-empty-zone 10.in-addr.arpa;
fetches-per-zone 40;
+
+ // Some domains in this tests have TTL of 2, so let's pick
+ // a value below it.
+ min-delegation-ttl 1;
};
key rndc_key {
request-nsid yes;
request-zoneversion yes;
minimal-any no;
+
+ // "checking that removal of a delegation is honoured"
+ // test has a delegation with a TTL of 5 seconds, so let's
+ // min a min below it.
+ min-delegation-ttl 3;
};
// Don't break tests which depend on ans10 by requesting
exceed 90 seconds and is truncated to 90 seconds if set to a greater
value.
+.. namedconf:statement:: min-delegation-ttl
+ :tags: server
+ :short: Configure the minimum time (in seconds) that the server caches delegations.
+
+ This sets the minimum time for which the server caches nameserver names and
+ glues for a delegation, in seconds. For convenience, TTL-style time-unit
+ suffixes may be used to specify the value. It also accepts ISO 8601 duration
+ formats.
+
+ Setting a value of ``0`` disable the minimum check TTL for delegations. The
+ default :any:`min-delegation-ttl` is ``60`` seconds.
+
.. namedconf:statement:: max-delegation-servers
:tags: server
:short: Configure the maximum number of nameservers considered for a delegation
all queries to return SERVFAIL, because of lost caches of intermediate RRsets
(such as NS and glue AAAA/A records) in the resolution process.
+.. namedconf:statement:: max-delegation-ttl
+ :tags: server
+ :short: Configure the maximum time (in seconds) that the server caches delegations.
+
+ This sets the maximum time for which the server caches nameserver names and
+ glues for a delegation, in seconds. For convenience, TTL-style time-unit
+ suffixes may be used to specify the value. It also accepts ISO 8601 duration
+ formats.
+
+ Setting a value of ``0`` disable the maximum TTL check for delegations. The
+ default :any:`max-delegation-ttl` is ``0``.
+
.. namedconf:statement:: max-stale-ttl
:tags: server
:short: Specifies the maximum time that the server retains records past their normal expiry, to return them as stale records.
max-cache-ttl <duration>;
max-clients-per-query <integer>;
max-delegation-servers <integer>; // experimental
+ max-delegation-ttl <duration>;
max-ixfr-ratio ( unlimited | <percentage> );
max-journal-size ( default | unlimited | <sizeval> );
max-ncache-ttl <duration>;
memstatistics-file <quoted_string>;
message-compression <boolean>;
min-cache-ttl <duration>;
+ min-delegation-ttl <duration>;
min-ncache-ttl <duration>;
min-refresh-time <integer>;
min-retry-time <integer>;
max-cache-ttl <duration>;
max-clients-per-query <integer>;
max-delegation-servers <integer>; // experimental
+ max-delegation-ttl <duration>;
max-ixfr-ratio ( unlimited | <percentage> );
max-journal-size ( default | unlimited | <sizeval> );
max-ncache-ttl <duration>;
max-zone-ttl ( unlimited | <duration> ); // deprecated
message-compression <boolean>;
min-cache-ttl <duration>;
+ min-delegation-ttl <duration>;
min-ncache-ttl <duration>;
min-refresh-time <integer>;
min-retry-time <integer>;
return ISC_R_SUCCESS;
}
+static isc_result_t
+check_delegation_ttl(const cfg_obj_t *options) {
+ uint32_t min = 0, max = 0;
+ const cfg_obj_t *obj = NULL;
+
+ (void)cfg_map_get(options, "min-delegation-ttl", &obj);
+ if (obj != NULL) {
+ min = cfg_obj_asduration(obj);
+ }
+
+ obj = NULL;
+ (void)cfg_map_get(options, "max-delegation-ttl", &obj);
+ if (obj != NULL) {
+ max = cfg_obj_asduration(obj);
+ }
+
+ if (min != 0 && max != 0 && min >= max) {
+ cfg_obj_log(
+ obj, ISC_LOG_ERROR,
+ "When 'min-delegation-ttl' and 'max-delegation-ttl' "
+ "are both positive, 'min-delegation-ttl' must be "
+ "strictly less than 'max-delegation-ttl'");
+ return ISC_R_RANGE;
+ }
+
+ return ISC_R_SUCCESS;
+}
+
static isc_result_t
check_options(const cfg_obj_t *options, const cfg_obj_t *config,
bool check_algorithms, isc_mem_t *mctx, optlevel_t optlevel) {
}
}
}
+
+ tresult = check_delegation_ttl(options);
+ if (tresult != ISC_R_SUCCESS) {
+ result = tresult;
+ }
}
/*
{ "max-acache-size", NULL, CFG_CLAUSEFLAG_ANCIENT, NULL },
{ "max-cache-size", &cfg_type_maxcachesize, 0, NULL },
{ "max-cache-ttl", &cfg_type_duration, 0, NULL },
+ { "max-delegation-ttl", &cfg_type_duration, 0, NULL },
{ "max-clients-per-query", &cfg_type_uint32, 0, NULL },
{ "max-delegation-servers", &cfg_type_uint32,
CFG_CLAUSEFLAG_EXPERIMENTAL, NULL },
CFG_CLAUSEFLAG_EXPERIMENTAL, NULL },
{ "message-compression", &cfg_type_boolean, 0, NULL },
{ "min-cache-ttl", &cfg_type_duration, 0, NULL },
+ { "min-delegation-ttl", &cfg_type_duration, 0, NULL },
{ "min-ncache-ttl", &cfg_type_duration, 0, NULL },
{ "min-roots", NULL, CFG_CLAUSEFLAG_ANCIENT, NULL },
{ "minimal-any", &cfg_type_boolean, 0, NULL },