2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

Implement DNSTAP support in ns_client_sendraw()

ns_client_sendraw() is currently only used to relay UPDATE
responses back to the client.  dns_dt_send() is called with
this assumption.
This commit is contained in:
Mark Andrews 2020-11-09 13:44:22 +11:00
parent a66b638d41
commit b09727a765

View File

@ -370,6 +370,23 @@ ns_client_sendraw(ns_client_t *client, dns_message_t *message) {
r.base[0] = (client->message->id >> 8) & 0xff; r.base[0] = (client->message->id >> 8) & 0xff;
r.base[1] = client->message->id & 0xff; r.base[1] = client->message->id & 0xff;
#ifdef HAVE_DNSTAP
if (client->view != NULL) {
bool tcp = TCP_CLIENT(client);
dns_dtmsgtype_t dtmsgtype;
if (client->message->opcode == dns_opcode_update) {
dtmsgtype = DNS_DTTYPE_UR;
} else if ((client->message->flags & DNS_MESSAGEFLAG_RD) != 0) {
dtmsgtype = DNS_DTTYPE_CR;
} else {
dtmsgtype = DNS_DTTYPE_AR;
}
dns_dt_send(client->view, dtmsgtype, &client->peeraddr,
&client->destsockaddr, tcp, NULL,
&client->requesttime, NULL, &buffer);
}
#endif
client_sendpkg(client, &buffer); client_sendpkg(client, &buffer);
return; return;