Commit 286a7b6b authored by Tony Finch's avatar Tony Finch Committed by Evan Hunt
Browse files

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.
parent 488ae905
Pipeline #1239 passed with stages
in 6 minutes and 38 seconds
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]
 
......@@ -5,7 +12,7 @@
enum types. [GL !135]
 
4922. [bug] dnstap: Log the destination address of client
packets rather than the interface address.
packets rather than the interface address.
[GL #197]
 
4921. [cleanup] Add dns_fixedname_initname() and refactor the caller
......
......@@ -969,7 +969,7 @@ plus_option(char *option) {
if (cmd == NULL) {
printf(";; Invalid option %s\n", option);
return;
}
}
if (strncasecmp(cmd, "no", 2)==0) {
cmd += 2;
state = ISC_FALSE;
......
......@@ -1049,7 +1049,7 @@ plus_option(char *option, isc_boolean_t is_batchfile,
FULLCHECK("idnin");
#ifndef WITH_IDN_SUPPORT
fprintf(stderr, ";; IDN input support"
" not enabled\n");
" not enabled\n");
#else
lookup->idnin = state;
#endif
......@@ -1058,7 +1058,7 @@ plus_option(char *option, isc_boolean_t is_batchfile,
FULLCHECK("idnout");
#ifndef WITH_IDN_OUT_SUPPORT
fprintf(stderr, ";; IDN output support"
" not enabled\n");
" not enabled\n");
#else
lookup->idnout = state;
#endif
......
......@@ -1299,7 +1299,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
<command>dig</command> appropriately converts character encoding of
domain name before sending a request to DNS server or displaying a
reply from the server.
If you'd like to turn off the IDN support for some reason, use
If you'd like to turn off the IDN support for some reason, use
parameters <parameter>+noidnin</parameter> and
<parameter>+noidnout</parameter>.
</para>
......
/*
* 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;
};
/*
* 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;
};
/*
* 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;
};
/*
* 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;
};
/*
* 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;
};
};
/*
* 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;
};
/*
* 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;
};
/*
* 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;
};
/*
* 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;
};
/*
* 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;
};
};
/*
* 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;
};
/*
* 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;
};
......@@ -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>
 
......
......@@ -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>
......
......@@ -139,7 +139,7 @@ totext_soa(ARGS_TOTEXT) {
if (i >= 1) {
RETERR(str_totext(" (", target));
RETERR(dns_ttl_totext(num, ISC_TRUE,
ISC_TRUE, target));
ISC_TRUE, target));
RETERR(str_totext(")", target));
}
RETERR(str_totext(tctx->linebreak, target));
......
......@@ -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 },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment