mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Add separate prefetch nmhandle to ns_client_t
As the query_prefetch() or query_rpzfetch() could be called during "regular" fetch, we need to introduce separate storage for attaching the nmhandle during prefetching the records. The query_prefetch() and query_rpzfetch() are guarded for re-entrance by .query.prefetch member of ns_client_t, so we can reuse the same .prefetchhandle for both.
This commit is contained in:
@@ -183,12 +183,13 @@ struct ns_client {
|
|||||||
isc_task_t * task;
|
isc_task_t * task;
|
||||||
dns_view_t * view;
|
dns_view_t * view;
|
||||||
dns_dispatch_t * dispatch;
|
dns_dispatch_t * dispatch;
|
||||||
isc_nmhandle_t * handle; /* Permanent pointer to handle */
|
isc_nmhandle_t * handle; /* Permanent pointer to handle */
|
||||||
isc_nmhandle_t * sendhandle; /* Waiting for send callback */
|
isc_nmhandle_t * sendhandle; /* Waiting for send callback */
|
||||||
isc_nmhandle_t * reqhandle; /* Waiting for request callback
|
isc_nmhandle_t * reqhandle; /* Waiting for request callback
|
||||||
(query, update, notify) */
|
(query, update, notify) */
|
||||||
isc_nmhandle_t *fetchhandle; /* Waiting for recursive fetch */
|
isc_nmhandle_t *fetchhandle; /* Waiting for recursive fetch */
|
||||||
isc_nmhandle_t *updatehandle; /* Waiting for update callback */
|
isc_nmhandle_t *prefetchhandle; /* Waiting for prefetch / rpzfetch */
|
||||||
|
isc_nmhandle_t *updatehandle; /* Waiting for update callback */
|
||||||
unsigned char * tcpbuf;
|
unsigned char * tcpbuf;
|
||||||
dns_message_t * message;
|
dns_message_t * message;
|
||||||
unsigned char * sendbuf;
|
unsigned char * sendbuf;
|
||||||
|
@@ -2475,7 +2475,7 @@ prefetch_done(isc_task_t *task, isc_event_t *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
free_devent(client, &event, &devent);
|
free_devent(client, &event, &devent);
|
||||||
isc_nmhandle_detach(&client->fetchhandle);
|
isc_nmhandle_detach(&client->prefetchhandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2518,7 +2518,7 @@ query_prefetch(ns_client_t *client, dns_name_t *qname,
|
|||||||
peeraddr = NULL;
|
peeraddr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_nmhandle_attach(client->handle, &client->fetchhandle);
|
isc_nmhandle_attach(client->handle, &client->prefetchhandle);
|
||||||
options = client->query.fetchoptions | DNS_FETCHOPT_PREFETCH;
|
options = client->query.fetchoptions | DNS_FETCHOPT_PREFETCH;
|
||||||
result = dns_resolver_createfetch(
|
result = dns_resolver_createfetch(
|
||||||
client->view->resolver, qname, rdataset->type, NULL, NULL, NULL,
|
client->view->resolver, qname, rdataset->type, NULL, NULL, NULL,
|
||||||
@@ -2527,7 +2527,7 @@ query_prefetch(ns_client_t *client, dns_name_t *qname,
|
|||||||
&client->query.prefetch);
|
&client->query.prefetch);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
ns_client_putrdataset(client, &tmprdataset);
|
ns_client_putrdataset(client, &tmprdataset);
|
||||||
isc_nmhandle_detach(&client->fetchhandle);
|
isc_nmhandle_detach(&client->prefetchhandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
dns_rdataset_clearprefetch(rdataset);
|
dns_rdataset_clearprefetch(rdataset);
|
||||||
@@ -2732,7 +2732,7 @@ query_rpzfetch(ns_client_t *client, dns_name_t *qname, dns_rdatatype_t type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
options = client->query.fetchoptions;
|
options = client->query.fetchoptions;
|
||||||
isc_nmhandle_attach(client->handle, &client->fetchhandle);
|
isc_nmhandle_attach(client->handle, &client->prefetchhandle);
|
||||||
result = dns_resolver_createfetch(
|
result = dns_resolver_createfetch(
|
||||||
client->view->resolver, qname, type, NULL, NULL, NULL, peeraddr,
|
client->view->resolver, qname, type, NULL, NULL, NULL, peeraddr,
|
||||||
client->message->id, options, 0, NULL, client->task,
|
client->message->id, options, 0, NULL, client->task,
|
||||||
@@ -2740,7 +2740,7 @@ query_rpzfetch(ns_client_t *client, dns_name_t *qname, dns_rdatatype_t type) {
|
|||||||
&client->query.prefetch);
|
&client->query.prefetch);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
ns_client_putrdataset(client, &tmprdataset);
|
ns_client_putrdataset(client, &tmprdataset);
|
||||||
isc_nmhandle_detach(&client->fetchhandle);
|
isc_nmhandle_detach(&client->prefetchhandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user