Commit e14e179bf7 for bind

commit e14e179bf71d06f03c9fb96112a111c22a7fad49
Author: Alessio Podda <alessio@isc.org>
Date:   Wed Jul 8 17:37:35 2026 +0200

    Add dns_linkedname_attrs helper

    A common pattern is to cast a dns_linkedname_t to dns_name_t in order
    to access its attributes, this commit adds an helper function for
    that.

diff --git a/lib/dns/include/dns/name.h b/lib/dns/include/dns/name.h
index 9d0a4620da..cece6f1258 100644
--- a/lib/dns/include/dns/name.h
+++ b/lib/dns/include/dns/name.h
@@ -129,6 +129,11 @@ dns_linkedname_name(dns_linkedname_t *nwl) {
 	return nwl != NULL ? &nwl->name : NULL;
 }

+static inline struct dns_name_attrs *
+dns_linkedname_attrs(dns_linkedname_t *nwl) {
+	return nwl != NULL ? &nwl->name.attributes : NULL;
+}
+
 static inline const dns_name_t *
 dns_linkedname_name_const(const dns_linkedname_t *nwl) {
 	return nwl != NULL ? &nwl->name : NULL;
diff --git a/lib/dns/message.c b/lib/dns/message.c
index 50cabf3b59..15305506af 100644
--- a/lib/dns/message.c
+++ b/lib/dns/message.c
@@ -1473,8 +1473,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_section_t sectionid,
 			/*
 			 * Windows doesn't like TSIG names to be compressed.
 			 */
-			dns_linkedname_name(msg->tsigname)
-				->attributes.nocompress = true;
+			dns_linkedname_attrs(msg->tsigname)->nocompress = true;
 			free_name = false;
 		} else if (rdtype == dns_rdatatype_dname &&
 			   sectionid == DNS_SECTION_ANSWER &&
diff --git a/lib/dns/ncache.c b/lib/dns/ncache.c
index 3834abedc1..e323cafe85 100644
--- a/lib/dns/ncache.c
+++ b/lib/dns/ncache.c
@@ -156,7 +156,7 @@ dns_ncache_add(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
 	isc_buffer_init(&buffer, data, sizeof(data));

 	MSG_SECTION_FOREACH(message, DNS_SECTION_AUTHORITY, name) {
-		if (dns_linkedname_name(name)->attributes.ncache) {
+		if (dns_linkedname_attrs(name)->ncache) {
 			ISC_LIST_FOREACH(name->list, rdataset, link) {
 				if (!rdataset->attributes.ncache) {
 					continue;
diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c
index d75de9645a..80c2044fa4 100644
--- a/lib/dns/resolver.c
+++ b/lib/dns/resolver.c
@@ -6417,7 +6417,7 @@ rctx_cachename(respctx_t *rctx, dns_message_t *message,
 	 * We're not validating and have an answer ready; pass
 	 * it back to the caller.
 	 */
-	if (!need_validation && dns_linkedname_name(name)->attributes.answer &&
+	if (!need_validation && dns_linkedname_attrs(name)->answer &&
 	    !HAVE_ANSWER(fctx))
 	{
 		fctx->resp_result = ISC_R_SUCCESS;
@@ -6453,7 +6453,7 @@ rctx_cachemessage(respctx_t *rctx) {
 	     section <= DNS_SECTION_ADDITIONAL; section++)
 	{
 		MSG_SECTION_FOREACH(message, section, name) {
-			if (dns_linkedname_name(name)->attributes.cache) {
+			if (dns_linkedname_attrs(name)->cache) {
 				CHECK(rctx_cachename(rctx, message, name));
 			}
 		}
@@ -8860,8 +8860,8 @@ rctx_answer_any(respctx_t *rctx) {
 			return ISC_R_COMPLETE;
 		}

-		dns_linkedname_name(rctx->aname)->attributes.cache = true;
-		dns_linkedname_name(rctx->aname)->attributes.answer = true;
+		dns_linkedname_attrs(rctx->aname)->cache = true;
+		dns_linkedname_attrs(rctx->aname)->answer = true;
 		if (dns_rdatatype_issig(rdataset->type)) {
 			rdataset->attributes.answersig = true;
 		} else {
@@ -8879,7 +8879,7 @@ rctx_answer_any(respctx_t *rctx) {
 	 * would leave the fetch waiting for a validator that is never
 	 * started.
 	 */
-	if (!dns_linkedname_name(rctx->aname)->attributes.cache) {
+	if (!dns_linkedname_attrs(rctx->aname)->cache) {
 		rctx->result = DNS_R_FORMERR;
 		return ISC_R_COMPLETE;
 	}
@@ -8920,8 +8920,8 @@ rctx_answer_match(respctx_t *rctx) {
 		return ISC_R_COMPLETE;
 	}

-	dns_linkedname_name(rctx->aname)->attributes.cache = true;
-	dns_linkedname_name(rctx->aname)->attributes.answer = true;
+	dns_linkedname_attrs(rctx->aname)->cache = true;
+	dns_linkedname_attrs(rctx->aname)->answer = true;
 	rctx->ardataset->attributes.answer = true;
 	rctx->ardataset->attributes.cache = true;
 	rctx->ardataset->trust = rctx->trust;
@@ -8969,9 +8969,9 @@ rctx_answer_cname(respctx_t *rctx) {
 		return ISC_R_COMPLETE;
 	}

-	dns_linkedname_name(rctx->cname)->attributes.cache = true;
-	dns_linkedname_name(rctx->cname)->attributes.answer = true;
-	dns_linkedname_name(rctx->cname)->attributes.chaining = true;
+	dns_linkedname_attrs(rctx->cname)->cache = true;
+	dns_linkedname_attrs(rctx->cname)->answer = true;
+	dns_linkedname_attrs(rctx->cname)->chaining = true;
 	rctx->crdataset->attributes.answer = true;
 	rctx->crdataset->attributes.cache = true;
 	rctx->crdataset->attributes.chaining = true;
@@ -9019,9 +9019,9 @@ rctx_answer_dname(respctx_t *rctx) {
 		return ISC_R_COMPLETE;
 	}

-	dns_linkedname_name(rctx->dname)->attributes.cache = true;
-	dns_linkedname_name(rctx->dname)->attributes.answer = true;
-	dns_linkedname_name(rctx->dname)->attributes.chaining = true;
+	dns_linkedname_attrs(rctx->dname)->cache = true;
+	dns_linkedname_attrs(rctx->dname)->answer = true;
+	dns_linkedname_attrs(rctx->dname)->chaining = true;
 	rctx->drdataset->attributes.answer = true;
 	rctx->drdataset->attributes.cache = true;
 	rctx->drdataset->attributes.chaining = true;
@@ -9082,8 +9082,8 @@ rctx_authority_positive(respctx_t *rctx) {
 				if (dns_rdataset_matchestype(rdataset,
 							     dns_rdatatype_ns))
 				{
-					dns_linkedname_name(name)
-						->attributes.cache = true;
+					dns_linkedname_attrs(name)->cache =
+						true;
 					rdataset->attributes.cache = true;

 					if (rctx->aa) {
@@ -9347,8 +9347,7 @@ rctx_authority_negative(respctx_t *rctx) {
 					rctx->soa_name =
 						dns_linkedname_name(name);
 				}
-				dns_linkedname_name(name)->attributes.ncache =
-					true;
+				dns_linkedname_attrs(name)->ncache = true;
 				rdataset->attributes.ncache = true;
 				if (rctx->aa) {
 					rdataset->trust =
@@ -9402,12 +9401,12 @@ rctx_authority_dnssec(respctx_t *rctx) {
 			case dns_rdatatype_nsec:
 			case dns_rdatatype_nsec3:
 				if (rctx->negative) {
-					dns_linkedname_name(name)
-						->attributes.ncache = true;
+					dns_linkedname_attrs(name)->ncache =
+						true;
 					rdataset->attributes.ncache = true;
 				} else if (type == dns_rdatatype_nsec) {
-					dns_linkedname_name(name)
-						->attributes.cache = true;
+					dns_linkedname_attrs(name)->cache =
+						true;
 					rdataset->attributes.cache = true;
 				}

@@ -9453,8 +9452,7 @@ rctx_authority_dnssec(respctx_t *rctx) {
 					rctx->result = DNS_R_FORMERR;
 					return ISC_R_COMPLETE;
 				}
-				dns_linkedname_name(name)->attributes.cache =
-					true;
+				dns_linkedname_attrs(name)->cache = true;
 				rdataset->attributes.cache = true;

 				secure_domain = issecuredomain(
@@ -9632,10 +9630,10 @@ again:

 	dns_message_t *msg = rctx->query->rmessage;
 	MSG_SECTION_FOREACH(msg, section, name) {
-		if (!dns_linkedname_name(name)->attributes.chase) {
+		if (!dns_linkedname_attrs(name)->chase) {
 			continue;
 		}
-		dns_linkedname_name(name)->attributes.chase = false;
+		dns_linkedname_attrs(name)->chase = false;
 		ISC_LIST_FOREACH(name->list, rdataset, link) {
 			if (CHASE(rdataset)) {
 				rdataset->attributes.chase = false;
diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c
index f999e7d311..dcb6bb9918 100644
--- a/lib/dns/tsig.c
+++ b/lib/dns/tsig.c
@@ -856,7 +856,7 @@ dns_tsig_sign(dns_message_t *msg) {
 	msg->tsigname = owner;

 	/* Windows does not like the tsig name being compressed. */
-	dns_linkedname_name(msg->tsigname)->attributes.nocompress = true;
+	dns_linkedname_attrs(msg->tsigname)->nocompress = true;

 	return ISC_R_SUCCESS;

diff --git a/lib/ns/query.c b/lib/ns/query.c
index 644f428d01..64c9aba253 100644
--- a/lib/ns/query.c
+++ b/lib/ns/query.c
@@ -8724,7 +8724,7 @@ query_sign_nodata(query_ctx_t *qctx) {
 	if (!dns_rdataset_isassociated(qctx->rdataset) &&
 	    qctx->client->inner.wantdnssec)
 	{
-		if (!dns_linkedname_name(qctx->fname)->attributes.wildcard) {
+		if (!dns_linkedname_attrs(qctx->fname)->wildcard) {
 			dns_name_t *found;
 			dns_name_t *qname;
 			dns_fixedname_t fixed;
@@ -8844,7 +8844,7 @@ query_addnxrrsetnsec(query_ctx_t *qctx) {

 	INSIST(qctx->fname != NULL);

-	if (!dns_linkedname_name(qctx->fname)->attributes.wildcard) {
+	if (!dns_linkedname_attrs(qctx->fname)->wildcard) {
 		query_addrrset(qctx, &qctx->fname, &qctx->rdataset,
 			       &qctx->sigrdataset, NULL, DNS_SECTION_AUTHORITY);
 		return;