ports/dns/bind99/files/extrapatch-bind-min-override-ttl
Mathieu Arnold d4de1a5f8c Update to 9.9.10, 9.10.5, 9.11.1 and 9.12 to latest snapshot.
While there:

Make it more maintainable by sorting stuff in the Makefile and removing
vestigial pre 10.3 things.

Refresh the root zone hints.

"Fix" the configuration section telling you to get some top level
zones from f.root-servers.net, which does not allow axfr any more. [1]

PR:		218656 [1]
Reported by:	Thomas Steen Rasmussen / Tykling [1]
MFH:		2017Q2
Sponsored by:	Absolight
2017-04-20 13:12:35 +00:00

73 lines
2.4 KiB
Text

--- bin/named/config.c.orig 2017-04-14 03:50:56 UTC
+++ bin/named/config.c
@@ -141,6 +141,8 @@ options {\n\
min-roots 2;\n\
lame-ttl 600;\n\
max-ncache-ttl 10800; /* 3 hours */\n\
+ override-cache-ttl 0; /* do not override */\n\
+ min-cache-ttl 0; /* no minimal, zero is allowed */\n\
max-cache-ttl 604800; /* 1 week */\n\
transfer-format many-answers;\n\
max-cache-size 0;\n\
--- bin/named/server.c.orig 2017-04-14 03:50:56 UTC
+++ bin/named/server.c
@@ -2647,6 +2647,16 @@ configure_view(dns_view_t *view, cfg_obj
}
obj = NULL;
+ result = ns_config_get(maps, "override-cache-ttl", &obj);
+ INSIST(result == ISC_R_SUCCESS);
+ view->overridecachettl = cfg_obj_asuint32(obj);
+
+ obj = NULL;
+ result = ns_config_get(maps, "min-cache-ttl", &obj);
+ INSIST(result == ISC_R_SUCCESS);
+ view->mincachettl = cfg_obj_asuint32(obj);
+
+ obj = NULL;
result = ns_config_get(maps, "max-cache-ttl", &obj);
INSIST(result == ISC_R_SUCCESS);
view->maxcachettl = cfg_obj_asuint32(obj);
--- lib/dns/include/dns/view.h.orig 2017-04-14 03:50:56 UTC
+++ lib/dns/include/dns/view.h
@@ -148,6 +148,8 @@ struct dns_view {
isc_boolean_t provideixfr;
isc_boolean_t requestnsid;
dns_ttl_t maxcachettl;
+ dns_ttl_t mincachettl;
+ dns_ttl_t overridecachettl;
dns_ttl_t maxncachettl;
in_port_t dstport;
dns_aclenv_t aclenv;
--- lib/dns/resolver.c.orig 2017-04-14 03:50:56 UTC
+++ lib/dns/resolver.c
@@ -5117,6 +5117,18 @@ cache_name(fetchctx_t *fctx, dns_name_t
}
/*
+ * Enforce the configure cache TTL override.
+ */
+ if (res->view->overridecachettl)
+ rdataset->ttl = res->view->overridecachettl;
+
+ /*
+ * Enforce the configure minimum cache TTL.
+ */
+ if (rdataset->ttl < res->view->mincachettl)
+ rdataset->ttl = res->view->mincachettl;
+
+ /*
* Enforce the configure maximum cache TTL.
*/
if (rdataset->ttl > res->view->maxcachettl)
--- lib/isccfg/namedconf.c.orig 2017-04-14 03:50:56 UTC
+++ lib/isccfg/namedconf.c
@@ -1475,6 +1475,8 @@ view_clauses[] = {
{ "lame-ttl", &cfg_type_uint32, 0 },
{ "max-acache-size", &cfg_type_sizenodefault, 0 },
{ "max-cache-size", &cfg_type_sizenodefault, 0 },
+ { "override-cache-ttl", &cfg_type_uint32, 0 },
+ { "min-cache-ttl", &cfg_type_uint32, 0 },
{ "max-cache-ttl", &cfg_type_uint32, 0 },
{ "max-clients-per-query", &cfg_type_uint32, 0 },
{ "max-ncache-ttl", &cfg_type_uint32, 0 },