#ifdef ENABLE_AFL
if (client->manager->sctx->fuzztype == isc_fuzz_resolver) {
dns_adb_t *adb = NULL;
- dns_view_getadb(client->view, &adb);
+ dns_view_getadb(client->inner.view, &adb);
if (adb != NULL) {
dns_adb_flush(adb);
dns_adb_detach(&adb);
#ifdef HAVE_DNSTAP
/*
* Log dnstap data first, because client_sendpkg() may
- * leave client->view set to NULL.
+ * leave client->inner.view set to NULL.
*/
if (client->inner.view != NULL) {
dns_dt_send(client->inner.view, dtmsgtype,
/*
* matchingview() returning anything other than DNS_R_WAIT means it's
* not running in async mode, in which case 'result' must be equal to
- * 'client->viewmatchresult'.
+ * 'client->inner.viewmatchresult'.
*/
INSIST(result == client->inner.viewmatchresult);
}
/*
- * Call the specified hook function in every configured module that implements
- * that function. If any hook function returns NS_HOOK_RETURN, we
- * set 'result' and terminate processing by jumping to the 'cleanup' tag.
+ * Call the specified hook function in every configured module that
+ * implements that function. If any hook function returns NS_HOOK_RETURN,
+ * we set 'result' and terminate processing by jumping to the 'cleanup' tag.
+ *
+ * Before any hook point is reached, qctx->view must be initialized to
+ * point to a valid view.
*
- * (Note that a hook function may set the 'result' to ISC_R_SUCCESS but
+ * Note: that a hook function may set the 'result' to ISC_R_SUCCESS but
* still terminate processing within the calling function. That's why this
* is a macro instead of a static function; it needs to be able to use
- * 'goto cleanup' regardless of the return value.)
+ * 'goto cleanup' regardless of the return value.
*/
#define CALL_HOOK(_id, _qctx) \
if ((_qctx)->zhooks != NULL && \
* codes are ignored. This is intended for use with initialization and
* destruction calls which *must* run in every configured module.
*
- * (This could be implemented as a static void function, but is left as a
- * macro for symmetry with CALL_HOOK above.)
+ * Before any hook point is reached, qctx->view must be initialized to
+ * point to a valid view.
+ *
+ * This could be implemented as a static void function, but is left as a
+ * macro for symmetry with CALL_HOOK above.
*/
#define CALL_HOOK_NORETURN(_id, _qctx) \
if ((_qctx)->zhooks != NULL) { \
CTRACE(ISC_LOG_DEBUG(3), "query_reset");
- /*
- * Set up a transient qctx so we can call the NS_QUERY_RESET hook;
- * this will free resources being held by plugins for this
- * query, if any were configured.
- *
- * Note that NS_QUERY_RESET hook is called only if the view is not
- * NULL at this point. Otherwise, it means the client has been
- * reset even before the query starts, so we should not call this
- * hook as no other hook has been called before.
- */
- if (client->inner.view != NULL) {
- query_ctx_t qctx = { .view = client->inner.view,
- .client = client };
- if (client->query.authzone != NULL) {
- qctx.zhooks =
- dns_zone_gethooktable(client->query.authzone);
- }
-
- CALL_HOOK_NORETURN(NS_QUERY_RESET, &qctx);
- }
-
/*
* Cancel the fetch if it's running.
*/
static void
query_cleanup(ns_client_t *client) {
+ /*
+ * Set up a transient qctx so we can call the NS_QUERY_CLEANUP hook;
+ * this will free resources being held by plugins for this
+ * query, if any were configured.
+ */
+ query_ctx_t qctx = { .view = client->inner.view, .client = client };
+ if (client->query.authzone != NULL) {
+ qctx.zhooks = dns_zone_gethooktable(client->query.authzone);
+ }
+
+ CALL_HOOK_NORETURN(NS_QUERY_CLEANUP, &qctx);
+
query_reset(client, false);
}