diff --git a/lib/ns/client.c b/lib/ns/client.c index 627dfeb14f..c40f40572c 100644 --- a/lib/ns/client.c +++ b/lib/ns/client.c @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include @@ -269,7 +270,7 @@ ns_client_endrequest(ns_client_t *client) { */ if (client->recursionquota != NULL) { isc_quota_detach(&client->recursionquota); - if (client->query.prefetch == NULL) { + if (FETCH_RECTYPE_PREFETCH(client) == NULL) { ns_stats_decrement(client->manager->sctx->nsstats, ns_statscounter_recursclients); } diff --git a/lib/ns/include/ns/client.h b/lib/ns/include/ns/client.h index 71c223847b..67c641b7cc 100644 --- a/lib/ns/include/ns/client.h +++ b/lib/ns/include/ns/client.h @@ -170,13 +170,12 @@ struct ns_client { unsigned int attributes; dns_view_t *view; dns_dispatch_t *dispatch; - isc_nmhandle_t *handle; /* Permanent pointer to handle */ - isc_nmhandle_t *sendhandle; /* Waiting for send callback */ - isc_nmhandle_t *reqhandle; /* Waiting for request callback - (query, update, notify) */ - isc_nmhandle_t *fetchhandle; /* Waiting for recursive fetch */ - isc_nmhandle_t *prefetchhandle; /* Waiting for prefetch / rpzfetch */ - isc_nmhandle_t *updatehandle; /* Waiting for update callback */ + isc_nmhandle_t *handle; /* Permanent pointer to handle */ + isc_nmhandle_t *sendhandle; /* Waiting for send callback */ + isc_nmhandle_t *reqhandle; /* Waiting for request callback + (query, update, notify) */ + isc_nmhandle_t *fetchhandle; /* Waiting for recursive fetch */ + isc_nmhandle_t *updatehandle; /* Waiting for update callback */ unsigned char *tcpbuf; dns_message_t *message; unsigned char *sendbuf; diff --git a/lib/ns/include/ns/query.h b/lib/ns/include/ns/query.h index 8476705386..a2f77d35f0 100644 --- a/lib/ns/include/ns/query.h +++ b/lib/ns/include/ns/query.h @@ -95,7 +95,6 @@ struct ns_query { bool isreferral; isc_mutex_t fetchlock; dns_fetch_t *fetch; - dns_fetch_t *prefetch; ns_hookasync_t *hookactx; dns_rpz_st_t *rpz_st; isc_bufferlist_t namebufs; diff --git a/lib/ns/query.c b/lib/ns/query.c index e63eb956ec..6a7ebee0f0 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -2525,9 +2525,9 @@ prefetch_done(isc_task_t *task, isc_event_t *event) { CTRACE(ISC_LOG_DEBUG(3), "prefetch_done"); LOCK(&client->query.fetchlock); - if (client->query.prefetch != NULL) { - INSIST(devent->fetch == client->query.prefetch); - client->query.prefetch = NULL; + if (FETCH_RECTYPE_PREFETCH(client) != NULL) { + INSIST(devent->fetch == FETCH_RECTYPE_PREFETCH(client)); + FETCH_RECTYPE_PREFETCH(client) = NULL; } UNLOCK(&client->query.fetchlock); @@ -2537,7 +2537,7 @@ prefetch_done(isc_task_t *task, isc_event_t *event) { recursionquota_detach(client); free_devent(client, &event, &devent); - isc_nmhandle_detach(&client->prefetchhandle); + isc_nmhandle_detach(&HANDLE_RECTYPE_PREFETCH(client)); } /* @@ -2569,16 +2569,16 @@ fetch_and_forget(ns_client_t *client, dns_name_t *qname, dns_rdatatype_t qtype, peeraddr = NULL; } - isc_nmhandle_attach(client->handle, &client->prefetchhandle); + isc_nmhandle_attach(client->handle, &HANDLE_RECTYPE_PREFETCH(client)); options = client->query.fetchoptions | extra_fetch_options; result = dns_resolver_createfetch( client->view->resolver, qname, qtype, NULL, NULL, NULL, peeraddr, client->message->id, options, 0, NULL, client->manager->task, prefetch_done, client, tmprdataset, NULL, - &client->query.prefetch); + &FETCH_RECTYPE_PREFETCH(client)); if (result != ISC_R_SUCCESS) { ns_client_putrdataset(client, &tmprdataset); - isc_nmhandle_detach(&client->prefetchhandle); + isc_nmhandle_detach(&HANDLE_RECTYPE_PREFETCH(client)); } } @@ -2587,7 +2587,7 @@ query_prefetch(ns_client_t *client, dns_name_t *qname, dns_rdataset_t *rdataset) { CTRACE(ISC_LOG_DEBUG(3), "query_prefetch"); - if (client->query.prefetch != NULL || + if (FETCH_RECTYPE_PREFETCH(client) != NULL || client->view->prefetch_trigger == 0U || rdataset->ttl > client->view->prefetch_trigger || (rdataset->attributes & DNS_RDATASETATTR_PREFETCH) == 0) @@ -2762,7 +2762,7 @@ static void query_rpzfetch(ns_client_t *client, dns_name_t *qname, dns_rdatatype_t type) { CTRACE(ISC_LOG_DEBUG(3), "query_rpzfetch"); - if (client->query.prefetch != NULL) { + if (FETCH_RECTYPE_PREFETCH(client) != NULL) { return; }