fixup! refactor validated()

This commit is contained in:
Evan Hunt
2025-03-14 18:29:48 -07:00
parent e39d265a99
commit b735f2e821
+13 -18
View File
@@ -5910,7 +5910,7 @@ check_cacheable(dns_name_t *name, dns_rdataset_t *rdataset, bool fail) {
}
static void
fixttls(dns_view_t *view, dns_rdataset_t *set, dns_rdataset_t *sigset) {
fixttl(dns_view_t *view, dns_rdataset_t *set) {
/*
* Enforce the configured maximum and minimum cache TTL.
*/
@@ -5928,14 +5928,6 @@ fixttls(dns_view_t *view, dns_rdataset_t *set, dns_rdataset_t *sigset) {
if (set->ttl >= view->prefetch_eligible) {
set->attributes |= DNS_RDATASETATTR_PREFETCH;
}
/*
* Normalize the rdataset and sigrdataset TTLs.
*/
if (sigset != NULL) {
set->ttl = ISC_MIN(set->ttl, sigset->ttl);
sigset->ttl = set->ttl;
}
}
static isc_result_t
@@ -6144,22 +6136,25 @@ rctx_cachename(respctx_t *rctx, dns_message_t *message, dns_name_t *name) {
}
/*
* Find the RRSIG for this rdataset, if we have it.
* Make the TTL consistent with the configured
* maximum and minimum
*/
sigrdataset = getrrsig(name, rdataset->type);
/*
* Make the TTLs consistent with the configured
* maximum and minimum and with each other.
*/
fixttls(res->view, rdataset, sigrdataset);
fixttl(res->view, rdataset);
if (secure_domain && gettrust(rdataset) != dns_trust_glue) {
/*
* If this is a secure domain and the rdataset
* isn't glue, start a validator. The data will
* be cached when the validator finishes.
* be cached when the validator finishes. First,
* find the RRSIG and normalize the TTLs.
*/
sigrdataset = getrrsig(name, rdataset->type);
if (sigrdataset != NULL) {
rdataset->ttl = ISC_MIN(rdataset->ttl,
sigrdataset->ttl);
sigrdataset->ttl = rdataset->ttl;
}
result = rctx_cache_secure(rctx, message, name, node,
rdataset, sigrdataset,
need_validation);