From: Colin Vidal Date: Sun, 28 Sep 2025 20:37:33 +0000 (+0200) Subject: fix hookasyncctx renaming X-Git-Tag: v9.21.14~19^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cecb03d6db0a672f451cb30dbc21d60a8a38c1b2;p=thirdparty%2Fbind9.git fix hookasyncctx renaming The field `ns_hookasync_t` was initially named `hook_actx` and wrongly renamed `hook_aclctx` during a mass-renaming of various names for the config acl context into a consistent `aclctx` name (see !11003). Of course this is wrong as `ns_hookasync_t` has nothing to do with ACL but about _async_ context. This commit fixes the mistake by renaming this field `hookasyncctx` --- diff --git a/lib/ns/include/ns/query.h b/lib/ns/include/ns/query.h index bc1e2b0d3f6..c336c80dcae 100644 --- a/lib/ns/include/ns/query.h +++ b/lib/ns/include/ns/query.h @@ -118,7 +118,7 @@ struct ns_query { bool authdbset; bool isreferral; isc_mutex_t fetchlock; - ns_hookasync_t *hookaclctx; + ns_hookasync_t *hookasyncctx; dns_rpz_st_t *rpz_st; isc_bufferlist_t namebufs; ISC_LIST(ns_dbversion_t) activeversions; diff --git a/lib/ns/query.c b/lib/ns/query.c index 47d02947c3f..9f59e9a577f 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -797,9 +797,9 @@ ns_query_cancel(ns_client_t *client) { *fetchp = NULL; } } - if (client->query.hookaclctx != NULL) { - client->query.hookaclctx->cancel(client->query.hookaclctx); - client->query.hookaclctx = NULL; + if (client->query.hookasyncctx != NULL) { + client->query.hookasyncctx->cancel(client->query.hookasyncctx); + client->query.hookasyncctx = NULL; } UNLOCK(&client->query.fetchlock); } @@ -6607,9 +6607,9 @@ query_hookresume(void *arg) { REQUIRE(NS_CLIENT_VALID(client)); LOCK(&client->query.fetchlock); - if (client->query.hookaclctx != NULL) { - INSIST(rev->ctx == client->query.hookaclctx); - client->query.hookaclctx = NULL; + if (client->query.hookasyncctx != NULL) { + INSIST(rev->ctx == client->query.hookasyncctx); + client->query.hookasyncctx = NULL; canceled = false; client->inner.now = isc_stdtime_now(); } else { @@ -6732,7 +6732,7 @@ ns_query_hookasync(query_ctx_t *qctx, ns_query_starthookasync_t runasync, CTRACE(ISC_LOG_DEBUG(3), "ns_query_hookasync"); REQUIRE(NS_CLIENT_VALID(client)); - REQUIRE(client->query.hookaclctx == NULL); + REQUIRE(client->query.hookasyncctx == NULL); REQUIRE(FETCH_RECTYPE_NORMAL(client) == NULL); result = acquire_recursionquota(client); @@ -6743,7 +6743,7 @@ ns_query_hookasync(query_ctx_t *qctx, ns_query_starthookasync_t runasync, qctx_save(qctx, &saved_qctx); result = runasync(saved_qctx, client->manager->mctx, arg, client->manager->loop, query_hookresume, client, - &client->query.hookaclctx); + &client->query.hookasyncctx); if (result != ISC_R_SUCCESS) { goto cleanup_and_detach_from_quota; } diff --git a/tests/ns/query_test.c b/tests/ns/query_test.c index f7410f41ed1..53a4964147c 100644 --- a/tests/ns/query_test.c +++ b/tests/ns/query_test.c @@ -621,7 +621,7 @@ typedef struct hookasync_data { * this is actually called; otherwise tests would fail due to memory leak. */ static void -destroy_hookaclctx(ns_hookasync_t **ctxp) { +destroy_hookasyncctx(ns_hookasync_t **ctxp) { ns_hookasync_t *ctx = *ctxp; *ctxp = NULL; @@ -630,7 +630,7 @@ destroy_hookaclctx(ns_hookasync_t **ctxp) { /* 'cancel' callback of hook recursion ctx. */ static void -cancel_hookaclctx(ns_hookasync_t *ctx) { +cancel_hookasyncctx(ns_hookasync_t *ctx) { /* Mark the hook data so the test can confirm this is called. */ ((hookasync_data_t *)ctx->private)->canceled = true; } @@ -662,8 +662,8 @@ test_hookasync(query_ctx_t *qctx, isc_mem_t *mctx, void *arg, isc_loop_t *loop, asdata->rev = rev; *ctx = (ns_hookasync_t){ - .destroy = destroy_hookaclctx, - .cancel = cancel_hookaclctx, + .destroy = destroy_hookasyncctx, + .cancel = cancel_hookasyncctx, .private = asdata, }; isc_mem_attach(mctx, &ctx->mctx); @@ -931,7 +931,7 @@ run_hookasync_test(const ns__query_hookasync_test_params_t *test) { asdata.rev->cb(asdata.rev); /* Confirm necessary cleanup has been performed. */ - INSIST(qctx->client->query.hookaclctx == NULL); + INSIST(qctx->client->query.hookasyncctx == NULL); INSIST(qctx->client->inner.state == NS_CLIENTSTATE_WORKING); INSIST(ns_stats_get_counter( qctx->client->manager->sctx->nsstats, @@ -947,7 +947,7 @@ run_hookasync_test(const ns__query_hookasync_test_params_t *test) { INSIST(asdata.lasthookpoint == test->hookpoint2); } } else { - INSIST(qctx->client->query.hookaclctx == NULL); + INSIST(qctx->client->query.hookasyncctx == NULL); } /* @@ -1246,7 +1246,7 @@ typedef struct hookasync_e2e_data { /* Cancel callback. Just need to be defined, it doesn't have to do anything. */ static void -cancel_e2ehookaclctx(ns_hookasync_t *ctx) { +cancel_e2ehookasyncctx(ns_hookasync_t *ctx) { UNUSED(ctx); } @@ -1277,8 +1277,8 @@ test_hookasync_e2e(query_ctx_t *qctx, isc_mem_t *mctx, void *arg, asdata->rev = rev; *ctx = (ns_hookasync_t){ - .destroy = destroy_hookaclctx, - .cancel = cancel_e2ehookaclctx, + .destroy = destroy_hookasyncctx, + .cancel = cancel_e2ehookasyncctx, .private = asdata, }; isc_mem_attach(mctx, &ctx->mctx);