2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-24 19:18:50 +00:00

Allow TTL values when configuring TTLs and time intervals.

Options updated to use ttlvals: max-cache-ttl, max-ncache-ttl,
max-policy-ttl, fstrm-set-reopen-interval, interface-interval, and
min-update-interval.
This commit is contained in:
Tony Finch 2018-04-12 18:42:39 +01:00 committed by Evan Hunt
parent 488ae9051e
commit 286a7b6b9a
22 changed files with 303 additions and 23 deletions

View File

@ -1,3 +1,10 @@
4925. [func] Several configuration options that define intervals
can now take TTL value suffixes (for example, 2h or 1d)
in addition to integer parameters. These include
max-cache-ttl, max-ncache-ttl, max-policy-ttl,
fstrm-set-reopen-interval, interface-interval, and
min-update-interval. [GL #203]
4924. [cleanup] Clean up the isc_string_* namespace and leave
only strlcpy and strlcat. [GL #178]

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
interface-interval 1x;
};

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
view one {
max-cache-ttl 1x;
};

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
view one {
max-ncache-ttl 1x;
};

View File

@ -0,0 +1,22 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
zone "example.com." {
type master;
file "example.com.zone";
};
options {
response-policy {
zone "example.com." policy given;
}
max-policy-ttl 1x;
};

View File

@ -0,0 +1,23 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
zone "example.com." {
type master;
file "example.com.zone";
};
options {
response-policy {
zone "example.com."
policy given
min-update-interval 5x;
};
};

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
interface-interval 1h;
};

View File

@ -0,0 +1,32 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
view one {
max-cache-ttl 0;
};
view two {
max-cache-ttl 86400;
};
view three {
max-cache-ttl 4000000000;
};
view four {
max-cache-ttl 3600s;
};
view five {
max-cache-ttl 1h;
};
view six {
max-cache-ttl 1d;
};
view seven {
max-cache-ttl 1w;
};

View File

@ -0,0 +1,32 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
view one {
max-ncache-ttl 0;
};
view two {
max-ncache-ttl 86400;
};
view three {
max-ncache-ttl 4000000000;
};
view four {
max-ncache-ttl 3600s;
};
view five {
max-ncache-ttl 1h;
};
view six {
max-ncache-ttl 1d;
};
view seven {
max-ncache-ttl 1w;
};

View File

@ -0,0 +1,22 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
zone "example.com." {
type master;
file "example.com.zone";
};
options {
response-policy {
zone "example.com." policy given;
}
max-policy-ttl 1h;
};

View File

@ -0,0 +1,23 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
zone "example.com." {
type master;
file "example.com.zone";
};
options {
response-policy {
zone "example.com."
policy given
min-update-interval 5m;
};
};

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
fstrm-set-reopen-interval 1x;
};

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
options {
fstrm-set-reopen-interval 5m;
};

View File

@ -4454,6 +4454,8 @@ badresp:1,adberr:0,findfail:0,valfail:0]
reopen a closed output stream. The minimum is 1 second,
the maximum is 600 seconds (10 minutes), and the default
is 5 seconds.
For convenience, TTL-style time unit suffixes may be
used to specify the value.
</simpara>
</listitem>
</itemizedlist>
@ -8560,8 +8562,9 @@ avoid-v6-udp-ports { 40000; range 50000 60000; };
begin listening for queries on any newly discovered
interfaces (provided they are allowed by the
<command>listen-on</command> configuration), and
will
stop listening on interfaces that have gone away.
will stop listening on interfaces that have gone away.
For convenience, TTL-style time unit suffixes may be
used to specify the value.
</para>
</listitem>
</varlistentry>
@ -8871,8 +8874,9 @@ avoid-v6-udp-ports { 40000; range 50000 60000; };
To reduce network traffic and increase performance,
the server stores negative answers. <command>max-ncache-ttl</command> is
used to set a maximum retention time for these answers in
the server
in seconds. The default
the server in seconds.
For convenience, TTL-style time unit suffixes may be
used to specify the value. The default
<command>max-ncache-ttl</command> is <literal>10800</literal> seconds (3 hours).
<command>max-ncache-ttl</command> cannot exceed
7 days and will
@ -8887,6 +8891,8 @@ avoid-v6-udp-ports { 40000; range 50000 60000; };
<para>
Sets the maximum time for which the server will
cache ordinary (positive) answers in seconds.
For convenience, TTL-style time unit suffixes may be
used to specify the value.
The default is 604800 (one week).
A value of zero may cause all queries to return
SERVFAIL, because of lost caches of intermediate
@ -10164,6 +10170,8 @@ deny-answer-aliases { "example.net"; };
to a maximum value.
The <command>max-policy-ttl</command> clause changes the
maximum seconds from its default of 5.
For convenience, TTL-style time unit suffixes may be
used to specify the value.
</para>
<para>
@ -10250,6 +10258,8 @@ example.com CNAME rpz-tcp-only.
than <option>min-update-interval</option> seconds after the most
recent update, then the changes will not be carried out until this
interval has elapsed. The default is <literal>5</literal> seconds.
For convenience, TTL-style time unit suffixes may be
used to specify the value.
</para>
</section>

View File

@ -140,6 +140,21 @@
supported by default; previously the limit was 32. [GL #123]
</para>
</listitem>
<listitem>
<para>
Several configuration options for time periods can now use
TTL value suffixes (for example, <literal>2h</literal> or
<literal>1d</literal>) in addition to an integer number of
seconds. These include:
<command>fstrm-set-reopen-interval</command>;
<command>interface-interval</command>;
<command>max-cache-ttl</command>;
<command>max-ncache-ttl</command>;
<command>max-policy-ttl</command>;
<command>min-update-interval</command>.
[GL #203]
</para>
</listitem>
</itemizedlist>
</section>

View File

@ -1065,7 +1065,7 @@ options_clauses[] = {
{ "fstrm-set-output-notify-threshold", &cfg_type_uint32, 0 },
{ "fstrm-set-output-queue-model", &cfg_type_fstrm_model, 0 },
{ "fstrm-set-output-queue-size", &cfg_type_uint32, 0 },
{ "fstrm-set-reopen-interval", &cfg_type_uint32, 0 },
{ "fstrm-set-reopen-interval", &cfg_type_ttlval, 0 },
#else
{ "fstrm-set-buffer-hint", &cfg_type_uint32,
CFG_CLAUSEFLAG_NOTCONFIGURED },
@ -1079,7 +1079,7 @@ options_clauses[] = {
CFG_CLAUSEFLAG_NOTCONFIGURED },
{ "fstrm-set-output-queue-size", &cfg_type_uint32,
CFG_CLAUSEFLAG_NOTCONFIGURED },
{ "fstrm-set-reopen-interval", &cfg_type_uint32,
{ "fstrm-set-reopen-interval", &cfg_type_ttlval,
CFG_CLAUSEFLAG_NOTCONFIGURED },
#endif /* HAVE_DNSTAP */
#ifdef HAVE_GEOIP
@ -1095,7 +1095,7 @@ options_clauses[] = {
{ "host-statistics", &cfg_type_boolean, CFG_CLAUSEFLAG_NOTIMP },
{ "host-statistics-max", &cfg_type_uint32, CFG_CLAUSEFLAG_NOTIMP },
{ "hostname", &cfg_type_qstringornone, 0 },
{ "interface-interval", &cfg_type_uint32, 0 },
{ "interface-interval", &cfg_type_ttlval, 0 },
{ "keep-response-order", &cfg_type_bracketed_aml, 0 },
{ "listen-on", &cfg_type_listenon, CFG_CLAUSEFLAG_MULTI },
{ "listen-on-v6", &cfg_type_listenon, CFG_CLAUSEFLAG_MULTI },
@ -1621,8 +1621,8 @@ static cfg_type_t cfg_type_rpz_policy = {
static cfg_tuplefielddef_t rpz_zone_fields[] = {
{ "zone name", &cfg_type_rpz_zone, 0 },
{ "log", &cfg_type_boolean, 0 },
{ "max-policy-ttl", &cfg_type_uint32, 0 },
{ "min-update-interval", &cfg_type_uint32, 0 },
{ "max-policy-ttl", &cfg_type_ttlval, 0 },
{ "min-update-interval", &cfg_type_ttlval, 0 },
{ "policy", &cfg_type_rpz_policy, 0 },
{ "recursive-only", &cfg_type_boolean, 0 },
{ "nsip-enable", &cfg_type_boolean, 0 },
@ -1642,8 +1642,8 @@ static cfg_type_t cfg_type_rpz_list = {
static cfg_tuplefielddef_t rpz_fields[] = {
{ "zone list", &cfg_type_rpz_list, 0 },
{ "break-dnssec", &cfg_type_boolean, 0 },
{ "max-policy-ttl", &cfg_type_uint32, 0 },
{ "min-update-interval", &cfg_type_uint32, 0 },
{ "max-policy-ttl", &cfg_type_ttlval, 0 },
{ "min-update-interval", &cfg_type_ttlval, 0 },
{ "min-ns-dots", &cfg_type_uint32, 0 },
{ "nsip-wait-recurse", &cfg_type_boolean, 0 },
{ "qname-wait-recurse", &cfg_type_boolean, 0 },
@ -1680,7 +1680,7 @@ static cfg_tuplefielddef_t catz_zone_fields[] = {
{ "default-masters", &cfg_type_namesockaddrkeylist, 0 },
{ "zone-directory", &cfg_type_qstring, 0 },
{ "in-memory", &cfg_type_boolean, 0 },
{ "min-update-interval", &cfg_type_uint32, 0 },
{ "min-update-interval", &cfg_type_ttlval, 0 },
{ NULL, NULL, 0 }
};
static cfg_type_t cfg_type_catz_tuple = {
@ -1916,9 +1916,9 @@ view_clauses[] = {
{ "max-acache-size", &cfg_type_sizenodefault,
CFG_CLAUSEFLAG_OBSOLETE },
{ "max-cache-size", &cfg_type_sizeorpercent, 0 },
{ "max-cache-ttl", &cfg_type_uint32, 0 },
{ "max-cache-ttl", &cfg_type_ttlval, 0 },
{ "max-clients-per-query", &cfg_type_uint32, 0 },
{ "max-ncache-ttl", &cfg_type_uint32, 0 },
{ "max-ncache-ttl", &cfg_type_ttlval, 0 },
{ "max-recursion-depth", &cfg_type_uint32, 0 },
{ "max-recursion-queries", &cfg_type_uint32, 0 },
{ "max-stale-ttl", &cfg_type_ttlval, 0 },

View File

@ -637,6 +637,7 @@
./bin/tests/system/checkconf/bad-hint.conf CONF-C 2014,2016,2018
./bin/tests/system/checkconf/bad-in-view-dup.conf CONF-C 2018
./bin/tests/system/checkconf/bad-inline-slave.conf CONF-C 2013,2016,2018
./bin/tests/system/checkconf/bad-interface-interval.conf CONF-C 2018
./bin/tests/system/checkconf/bad-keep-response-order.conf CONF-C 2015,2016,2018
./bin/tests/system/checkconf/bad-lifetime.conf CONF-C 2014,2016,2018
./bin/tests/system/checkconf/bad-lmdb-mapsize-bogus.conf CONF-C 2017,2018
@ -645,6 +646,8 @@
./bin/tests/system/checkconf/bad-lmdb-mapsize-unlimited.conf CONF-C 2017,2018
./bin/tests/system/checkconf/bad-many.conf CONF-C 2005,2012,2015,2016,2018
./bin/tests/system/checkconf/bad-master-request-ixfr.conf CONF-C 2014,2016,2018
./bin/tests/system/checkconf/bad-maxcachettl.conf CONF-C 2018
./bin/tests/system/checkconf/bad-maxncachettl.conf CONF-C 2018
./bin/tests/system/checkconf/bad-maxttlmap.conf CONF-C 2014,2016,2018
./bin/tests/system/checkconf/bad-noddns.conf CONF-C 2014,2016,2018
./bin/tests/system/checkconf/bad-options-also-notify.conf CONF-C 2016,2018
@ -663,6 +666,8 @@
./bin/tests/system/checkconf/bad-rate-limit-slip.conf CONF-C 2016,2018
./bin/tests/system/checkconf/bad-rate-limit-window.conf CONF-C 2016,2018
./bin/tests/system/checkconf/bad-rpz-too-many-zones.conf CONF-C 2018
./bin/tests/system/checkconf/bad-rpz-ttl.conf CONF-C 2018
./bin/tests/system/checkconf/bad-rpz-update.conf CONF-C 2018
./bin/tests/system/checkconf/bad-rpz-zone.conf CONF-C 2016,2018
./bin/tests/system/checkconf/bad-sharedwritable1.conf CONF-C 2014,2016,2018
./bin/tests/system/checkconf/bad-sharedwritable2.conf CONF-C 2014,2016,2018
@ -702,12 +707,17 @@
./bin/tests/system/checkconf/good-class.conf CONF-C 2015,2016,2018
./bin/tests/system/checkconf/good-dlv-dlv.example.com.conf CONF-C 2017,2018
./bin/tests/system/checkconf/good-glue-cache.conf CONF-C 2017,2018
./bin/tests/system/checkconf/good-interface-interval.conf CONF-C 2018
./bin/tests/system/checkconf/good-lmdb-mapsize-largest.conf CONF-C 2017,2018
./bin/tests/system/checkconf/good-lmdb-mapsize-smallest.conf CONF-C 2017,2018
./bin/tests/system/checkconf/good-maxcachettl.conf CONF-C 2018
./bin/tests/system/checkconf/good-maxncachettl.conf CONF-C 2018
./bin/tests/system/checkconf/good-nested.conf CONF-C 2015,2016,2018
./bin/tests/system/checkconf/good-options-also-notify.conf CONF-C 2016,2018
./bin/tests/system/checkconf/good-printtime.conf CONF-C 2016,2018
./bin/tests/system/checkconf/good-response-dot.conf CONF-C 2017,2018
./bin/tests/system/checkconf/good-rpz-ttl.conf CONF-C 2018
./bin/tests/system/checkconf/good-rpz-update.conf CONF-C 2018
./bin/tests/system/checkconf/good-update-policy1.conf CONF-C 2018
./bin/tests/system/checkconf/good-update-policy10.conf CONF-C 2018
./bin/tests/system/checkconf/good-update-policy11.conf CONF-C 2018
@ -1102,6 +1112,7 @@
./bin/tests/system/dnssec/signer/remove.db.in ZONE 2016,2018
./bin/tests/system/dnssec/signer/remove2.db.in ZONE 2016,2018
./bin/tests/system/dnssec/tests.sh SH 2000,2001,2002,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018
./bin/tests/system/dnstap/bad-fstrm-reopen-interval.conf CONF-C 2018
./bin/tests/system/dnstap/bad-fstrm-set-buffer-hint-max.conf CONF-C 2016,2018
./bin/tests/system/dnstap/bad-fstrm-set-buffer-hint-min.conf CONF-C 2016,2018
./bin/tests/system/dnstap/bad-fstrm-set-flush-timeout-max.conf CONF-C 2016,2018
@ -1116,6 +1127,7 @@
./bin/tests/system/dnstap/bad-fstrm-set-reopen-interval-min.conf CONF-C 2016,2018
./bin/tests/system/dnstap/bad-size-version.conf CONF-C 2017,2018
./bin/tests/system/dnstap/clean.sh SH 2015,2016,2017,2018
./bin/tests/system/dnstap/good-fstrm-reopen-interval.conf CONF-C 2018
./bin/tests/system/dnstap/good-fstrm-set-buffer-hint.conf CONF-C 2016,2018
./bin/tests/system/dnstap/good-fstrm-set-flush-timeout.conf CONF-C 2016,2018
./bin/tests/system/dnstap/good-fstrm-set-input-queue-size.conf CONF-C 2016,2018
@ -1377,10 +1389,8 @@
./bin/tests/system/gost/setup.sh SH 2010,2012,2014,2016,2017,2018
./bin/tests/system/gost/tests.sh SH 2010,2012,2013,2016,2018
./bin/tests/system/idna/clean.sh SH 2018
./bin/tests/system/idna/ns1/named.conf CONF-C 2018
./bin/tests/system/idna/ns1/named.conf.in CONF-C 2018
./bin/tests/system/idna/ns1/root.db ZONE 2018
./bin/tests/system/idna/prereq.sh SH 2018
./bin/tests/system/idna/setup.sh SH 2018
./bin/tests/system/idna/tests.sh SH 2018
./bin/tests/system/ifconfig.bat BAT 2016,2018