client_put_tcp_buffer(client);
}
+ if (client->inner.reqbuf != NULL) {
+ isc_mem_put(client->manager->mctx, client->inner.reqbuf,
+ client->inner.reqbuf_size);
+ client->inner.reqbuf_size = 0;
+ }
+
+ if (client->inner.buffer != NULL) {
+ isc_buffer_initnull(client->inner.buffer);
+ }
+
if (client->inner.keytag != NULL) {
isc_mem_put(client->manager->mctx, client->inner.keytag,
client->inner.keytag_len);
result = ns_client_setup_view(client, &netaddr);
if (result == DNS_R_WAIT) {
+#ifdef HAVE_DNSTAP
+ /*
+ * The request is finished asynchronously, but the receive
+ * buffer is only valid during this callback; copy it so it
+ * survives the asynchronous hop for dnstap logging.
+ */
+ isc_region_t r;
+ INSIST(client->inner.reqbuf == NULL);
+ isc_buffer_usedregion(client->inner.buffer, &r);
+ if (r.length != 0) {
+ client->inner.reqbuf =
+ isc_mem_get(client->manager->mctx, r.length);
+ client->inner.reqbuf_size = r.length;
+ memmove(client->inner.reqbuf, r.base, r.length);
+ isc_buffer_init(&client->inner.tbuffer,
+ client->inner.reqbuf, r.length);
+ isc_buffer_add(&client->inner.tbuffer, r.length);
+ client->inner.buffer = &client->inner.tbuffer;
+ }
+#else
+ isc_buffer_initnull(client->inner.buffer);
+#endif /* #ifdef HAVE_DNSTAP */
+
return;
}
int16_t ednsversion; /* -1 noedns */
uint16_t additionaldepth;
void (*cleanup)(ns_client_t *);
- isc_time_t requesttime;
- isc_stdtime_t now;
- isc_time_t tnow;
- dns_name_t signername; /*%< [T]SIG key name */
- dns_name_t *signer; /*%< NULL if not valid sig */
- isc_result_t sigresult;
- isc_result_t viewmatchresult;
- isc_buffer_t *buffer;
- isc_buffer_t tbuffer;
+ isc_time_t requesttime;
+ isc_stdtime_t now;
+ isc_time_t tnow;
+ dns_name_t signername; /*%< [T]SIG key name */
+ dns_name_t *signer; /*%< NULL if not valid sig */
+ isc_result_t sigresult;
+ isc_result_t viewmatchresult;
+ isc_buffer_t *buffer;
+ isc_buffer_t tbuffer;
+ unsigned char *reqbuf; /*%< request copy for async path */
+ size_t reqbuf_size;
dns_name_t rad; /* Zone rad domain */