From 93e6e72eb6db29afa8a110cab5db78d0533682b8 Mon Sep 17 00:00:00 2001 From: Colin Vidal Date: Thu, 9 Jan 2025 12:01:28 +0100 Subject: [PATCH 1/2] remove validator link form fetchctx struct fetchctx does have a list of pending validators as well as a pointer to the HEAD validator. Remove the validator pointer to avoid confusion, as there is no perticular reasons to have it directly accessible outside of the list. --- lib/dns/include/dns/resolver.h | 2 +- lib/dns/resolver.c | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/lib/dns/include/dns/resolver.h b/lib/dns/include/dns/resolver.h index 93a215598c..62ffb9885f 100644 --- a/lib/dns/include/dns/resolver.h +++ b/lib/dns/include/dns/resolver.h @@ -633,4 +633,4 @@ dns_resolver_freefresp(dns_fetchresponse_t **frespp); * * Requires: * \li 'frespp' is valid. No-op if *frespp == NULL - */ + */ \ No newline at end of file diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 70900c4cc0..5a1be00835 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -381,7 +381,6 @@ struct fetchctx { isc_sockaddrlist_t bad; ISC_LIST(struct tried) edns; isc_sockaddrlist_t bad_edns; - dns_validator_t *validator; ISC_LIST(dns_validator_t) validators; dns_db_t *cache; dns_adb_t *adb; @@ -983,10 +982,6 @@ valcreate(fetchctx_t *fctx, dns_message_t *message, dns_adbaddrinfo_t *addrinfo, &fctx->nfails, fctx->qc, fctx->gqc, &validator); RUNTIME_CHECK(result == ISC_R_SUCCESS); inc_stats(fctx->res, dns_resstatscounter_val); - if ((valoptions & DNS_VALIDATOR_DEFER) == 0) { - INSIST(fctx->validator == NULL); - fctx->validator = validator; - } ISC_LIST_APPEND(fctx->validators, validator, link); return ISC_R_SUCCESS; } @@ -5174,6 +5169,7 @@ has_000_label(dns_rdataset_t *nsecset) { static void validated(void *arg) { dns_validator_t *val = (dns_validator_t *)arg; + dns_validator_t *nextval = NULL; dns_adbaddrinfo_t *addrinfo = NULL; dns_dbnode_t *node = NULL; dns_dbnode_t *nsnode = NULL; @@ -5219,7 +5215,6 @@ validated(void *arg) { LOCK(&fctx->lock); ISC_LIST_UNLINK(fctx->validators, val, link); - fctx->validator = NULL; UNLOCK(&fctx->lock); /* @@ -5346,11 +5341,9 @@ validated(void *arg) { UNLOCK(&fctx->lock); - INSIST(fctx->validator == NULL); - - fctx->validator = ISC_LIST_HEAD(fctx->validators); - if (fctx->validator != NULL) { - dns_validator_send(fctx->validator); + nextval = ISC_LIST_HEAD(fctx->validators); + if (nextval != NULL) { + dns_validator_send(nextval); goto cleanup_fetchctx; } else if (sentresponse) { done = true; @@ -11078,4 +11071,4 @@ dns_resolver_freefresp(dns_fetchresponse_t **frespp) { *frespp = NULL; dns_ede_unlinkall(fresp->mctx, &fresp->edelist); isc_mem_putanddetach(&fresp->mctx, fresp, sizeof(*fresp)); -} +} \ No newline at end of file From c9529c0acb4651aecbdb4a8cfc75b63a455af579 Mon Sep 17 00:00:00 2001 From: Colin Vidal Date: Fri, 10 Jan 2025 17:31:46 +0100 Subject: [PATCH 2/2] remove ISC_LINK(link) property from fetchctx Likely because of historical reasons, struct fetchctx does have a list link property but is never used as a list. Remove this link property. --- lib/dns/resolver.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 5a1be00835..b2c26bde61 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -350,7 +350,6 @@ struct fetchctx { bool hashed; bool cloned; bool spilled; - ISC_LINK(struct fetchctx) link; ISC_LIST(dns_fetchresponse_t) resps; dns_edelist_t edelist; @@ -4782,7 +4781,6 @@ fctx_create(dns_resolver_t *res, isc_loop_t *loop, const dns_name_t *name, dns_view_getadb(res->view, &fctx->adb); ISC_LIST_INIT(fctx->resps); - ISC_LINK_INIT(fctx, link); fctx->magic = FCTX_MAGIC; /*