1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-17 08:01:36 +00:00
freebsd-ports/dns/bind911/files/extrapatch-bind-min-override-ttl
Mathieu Arnold 5f2f83cc31 Update BIND9 ports to 9.11.4, 9.12.2 and 9.13.2.
Sponsored by:	Absolight
2018-07-11 09:36:54 +00:00

74 lines
2.4 KiB
Plaintext

--- bin/named/config.c.orig 2018-06-10 06:06:33 UTC
+++ bin/named/config.c
@@ -176,6 +176,8 @@ options {\n\
" max-acache-size 16M;\n\
max-cache-size 90%;\n\
max-cache-ttl 604800; /* 1 week */\n\
+ min-cache-ttl 0; /* no minimal, zero is allowed */\n\
+ override-cache-ttl 0; /* do not override */\n\
max-clients-per-query 100;\n\
max-ncache-ttl 10800; /* 3 hours */\n\
max-recursion-depth 7;\n\
--- bin/named/server.c.orig 2018-06-10 06:06:33 UTC
+++ bin/named/server.c
@@ -3692,6 +3692,16 @@ configure_view(dns_view_t *view, dns_vie
}
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 2018-06-10 06:06:33 UTC
+++ lib/dns/include/dns/view.h
@@ -150,6 +150,8 @@ struct dns_view {
isc_boolean_t requestnsid;
isc_boolean_t sendcookie;
dns_ttl_t maxcachettl;
+ dns_ttl_t mincachettl;
+ dns_ttl_t overridecachettl;
dns_ttl_t maxncachettl;
isc_uint32_t nta_lifetime;
isc_uint32_t nta_recheck;
--- lib/dns/resolver.c.orig 2018-06-10 06:06:33 UTC
+++ lib/dns/resolver.c
@@ -5473,6 +5473,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 2018-06-10 06:06:33 UTC
+++ lib/isccfg/namedconf.c
@@ -1770,6 +1770,8 @@ view_clauses[] = {
#endif
{ "max-acache-size", &cfg_type_sizenodefault, 0 },
{ "max-cache-size", &cfg_type_sizeorpercent, 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 },