summaryrefslogtreecommitdiff
path: root/dns/bind9-devel/files/extrapatch-bind-min-override-ttl
blob: d3917c8d825e7e87ca1eb3b74d25b1e6c1cdbff7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Add the override-cache-ttl feature.

--- bin/include/defaultconfig.h.orig	2025-11-07 09:34:27 UTC
+++ bin/include/defaultconfig.h
@@ -159,6 +159,7 @@ options {\n\
 	notify-source *;\n\
 	notify-source-v6 *;\n\
 	nsec3-test-zone no;\n\
+	override-cache-ttl 0;\n\
 	parental-source *;\n\
 	parental-source-v6 *;\n\
 	provide-ixfr true;\n\
--- bin/named/server.c.orig	2025-11-07 09:34:27 UTC
+++ bin/named/server.c
@@ -4198,6 +4198,11 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewl
 	}
 
 	obj = NULL;
+	result = named_config_get(maps, "override-cache-ttl", &obj);
+	INSIST(result == ISC_R_SUCCESS);
+	view->overridecachettl = cfg_obj_asduration(obj);
+
+	obj = NULL;
 	result = named_config_get(maps, "max-cache-ttl", &obj);
 	INSIST(result == ISC_R_SUCCESS);
 	view->maxcachettl = cfg_obj_asduration(obj);
--- doc/arm/reference.rst.orig	2025-11-07 09:34:27 UTC
+++ doc/arm/reference.rst
@@ -4154,6 +4154,10 @@ Tuning
    cannot exceed 7 days and is silently truncated to 7 days if set to a
    greater value.
 
+.. namedconf:statement:: override-cache-ttl
+
+   Enforce the configure cache TTL override.
+
 .. namedconf:statement:: max-cache-ttl
    :tags: server
    :short: Specifies the maximum time (in seconds) that the server caches ordinary (positive) answers.
--- doc/misc/options.orig	2025-11-07 09:34:27 UTC
+++ doc/misc/options
@@ -171,6 +171,7 @@ options {
 	masterfile-style ( full | relative );
 	match-mapped-addresses <boolean>;
 	max-cache-size ( default | unlimited | <sizeval> | <percentage> );
+	override-cache-ttl <duration>;
 	max-cache-ttl <duration>;
 	max-clients-per-query <integer>;
 	max-ixfr-ratio ( unlimited | <percentage> );
--- lib/dns/include/dns/view.h.orig	2025-11-07 09:34:27 UTC
+++ lib/dns/include/dns/view.h
@@ -155,6 +155,7 @@ struct dns_view {
 	bool		      requestzoneversion;
 	bool		      sendcookie;
 	dns_ttl_t	      maxcachettl;
+	dns_ttl_t	      overridecachettl;
 	dns_ttl_t	      maxncachettl;
 	dns_ttl_t	      mincachettl;
 	dns_ttl_t	      minncachettl;
--- lib/dns/resolver.c.orig	2025-11-07 09:34:27 UTC
+++ lib/dns/resolver.c
@@ -5836,6 +5836,12 @@ fixttls(dns_view_t *view, dns_rdataset_t *rdataset,
 fixttls(dns_view_t *view, dns_rdataset_t *rdataset,
 	dns_rdataset_t *sigrdataset) {
 	/*
+	 * Enforce the configured cache TTL override.
+	 */
+        if (view->overridecachettl)
+                       rdataset->ttl = view->overridecachettl;
+
+	/*
 	 * Enforce the configured maximum and minimum cache TTL.
 	 */
 	if (rdataset->ttl > view->maxcachettl) {
--- lib/isccfg/namedconf.c.orig	2025-11-07 09:34:27 UTC
+++ lib/isccfg/namedconf.c
@@ -2399,6 +2399,7 @@ static cfg_clausedef_t view_clauses[] = {
 	{ "nta-lifetime", &cfg_type_duration, 0 },
 	{ "nta-recheck", &cfg_type_duration, 0 },
 	{ "nxdomain-redirect", &cfg_type_astring, 0 },
+	{ "override-cache-ttl", &cfg_type_duration, 0 },
 	{ "preferred-glue", &cfg_type_astring, 0 },
 	{ "prefetch", &cfg_type_prefetch, 0, prefetch_merge },
 	{ "provide-ixfr", &cfg_type_boolean, 0 },