]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use the current CDS and CDNSKEY TTLs
authorMark Andrews <marka@isc.org>
Tue, 12 Dec 2023 02:51:19 +0000 (13:51 +1100)
committerMark Andrews <marka@isc.org>
Wed, 3 Jan 2024 01:09:11 +0000 (12:09 +1100)
When adding new CDS and CDNSKEY records use the existing RRset
TTL if they already exist.

lib/dns/dnssec.c

index 92ac096134518aaf576edbd4eed9357105e27e84..6b45dfc1178049b77a8c15c2b9d6cf70556b684e 100644 (file)
@@ -2034,11 +2034,21 @@ dns_dnssec_syncupdate(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *rmkeys,
        unsigned char keybuf[DST_KEY_MAXSIZE];
        isc_result_t result;
        dns_dnsseckey_t *key;
+       dns_ttl_t cdsttl = ttl;
+       dns_ttl_t cdnskeyttl = ttl;
 
        REQUIRE(digests != NULL);
        REQUIRE(keys != NULL);
        REQUIRE(rmkeys != NULL);
 
+       if (dns_rdataset_isassociated(cds)) {
+               cdsttl = cds->ttl;
+       }
+
+       if (dns_rdataset_isassociated(cdnskey)) {
+               cdnskeyttl = cdnskey->ttl;
+       }
+
        for (key = ISC_LIST_HEAD(*keys); key != NULL;
             key = ISC_LIST_NEXT(key, link))
        {
@@ -2058,7 +2068,8 @@ dns_dnssec_syncupdate(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *rmkeys,
                        {
                                RETERR(add_cds(key, &cdnskeyrdata,
                                               (const char *)keystr, cds,
-                                              alg->digest, ttl, diff, mctx));
+                                              alg->digest, cdsttl, diff,
+                                              mctx));
                        }
 
                        if (gencdnskey &&
@@ -2071,7 +2082,7 @@ dns_dnssec_syncupdate(dns_dnsseckeylist_t *keys, dns_dnsseckeylist_t *rmkeys,
                                        "CDNSKEY for key %s is now published",
                                        keystr);
                                RETERR(addrdata(&cdnskeyrdata, diff, origin,
-                                               ttl, mctx));
+                                               cdnskeyttl, mctx));
                        }
                }