Commit b1ccf4a948 for bind

commit b1ccf4a94829c754088e2e7e6213a9f87405e9db
Author: OndÅ™ej Surý <ondrej@isc.org>
Date:   Tue Oct 13 16:29:24 2026 +0200

    Let a CNAME answer DS lookups from the cache again

    Excluding at-parent types from CNAME matching in qpcache_find() turned
    every DS lookup at a node holding only a CNAME into a cache miss: the
    resolver refetched the name, got the same CNAME back, and never cached
    anything the lookup could hit, so such DS queries went upstream every
    time.

    The exclusion was meant to keep a child's apex CNAME from hiding the
    parent's DS data, but the equal-rank rule already prefers a cached DS or
    its denial over the CNAME, and the validator maps a CNAME result to a DS
    fetch on its own.  Treat DS like any other type and let freshness decide.

diff --git a/lib/dns/qpcache.c b/lib/dns/qpcache.c
index 26818af363..882cc6a396 100644
--- a/lib/dns/qpcache.c
+++ b/lib/dns/qpcache.c
@@ -1498,7 +1498,7 @@ qpcache_find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
 	 * but belongs to the parent zone and must be looked up independently.
 	 */
 	if (type == dns_rdatatype_nsec || type == dns_rdatatype_rrsig ||
-	    dns_rdatatype_atparent(type) || type == dns_rdatatype_any)
+	    type == dns_rdatatype_any)
 	{
 		cname_ok = false;
 	}
diff --git a/tests/dns/qpdb_test.c b/tests/dns/qpdb_test.c
index 188c004f10..58bccbafaf 100644
--- a/tests/dns/qpdb_test.c
+++ b/tests/dns/qpdb_test.c
@@ -479,8 +479,8 @@ ISC_LOOP_TEST_IMPL(cname_precedence) {
 			.type2 = none,
 			.rank2 = 0,
 			.qtype = ds,
-			.expected_result = ISC_R_NOTFOUND,
-			.expected_type = none,
+			.expected_result = DNS_R_CNAME,
+			.expected_type = cname,
 			.expected_stale = false,
 		},
 		/* A lone stale CNAME answers ordinary types, including NS, but
@@ -511,9 +511,9 @@ ISC_LOOP_TEST_IMPL(cname_precedence) {
 			.type2 = none,
 			.rank2 = 0,
 			.qtype = ds,
-			.expected_result = ISC_R_NOTFOUND,
-			.expected_type = none,
-			.expected_stale = false,
+			.expected_result = DNS_R_CNAME,
+			.expected_type = cname,
+			.expected_stale = true,
 		},
 		/* Delegation data beside a CNAME is found by its own type. */
 		{