2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

dnstap query_message field was erroneously set with responses

The dnstap query_message field was in some cases being filled in
with response messages, along with the response_message field.
The query_message field should only be used when logging requests,
and the response_message field only when logging responses.
This commit is contained in:
Evan Hunt
2022-08-26 15:38:34 -07:00
parent 692975746f
commit 3ccfff8ab6

View File

@@ -807,10 +807,11 @@ dns_dt_send(dns_view_t *view, dns_dtmsgtype_t msgtype, isc_sockaddr_t *qaddr,
dm.m.response_time_nsec = isc_time_nanoseconds(t);
dm.m.has_response_time_nsec = 1;
cpbuf(buf, &dm.m.response_message, &dm.m.has_response_message);
/* Types RR and FR get both query and response times */
if (msgtype == DNS_DTTYPE_CR || msgtype == DNS_DTTYPE_AR) {
/*
* Types RR and FR can fall through and get the query
* time set as well. Any other response type, break.
*/
if (msgtype != DNS_DTTYPE_RR && msgtype != DNS_DTTYPE_FR) {
break;
}
@@ -830,8 +831,6 @@ dns_dt_send(dns_view_t *view, dns_dtmsgtype_t msgtype, isc_sockaddr_t *qaddr,
dm.m.has_query_time_sec = 1;
dm.m.query_time_nsec = isc_time_nanoseconds(t);
dm.m.has_query_time_nsec = 1;
cpbuf(buf, &dm.m.query_message, &dm.m.has_query_message);
break;
default:
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DNSTAP,
@@ -840,6 +839,13 @@ dns_dt_send(dns_view_t *view, dns_dtmsgtype_t msgtype, isc_sockaddr_t *qaddr,
return;
}
/* Query and response messages */
if ((msgtype & DNS_DTTYPE_QUERY) != 0) {
cpbuf(buf, &dm.m.query_message, &dm.m.has_query_message);
} else if ((msgtype & DNS_DTTYPE_RESPONSE) != 0) {
cpbuf(buf, &dm.m.response_message, &dm.m.has_response_message);
}
/* Zone/bailiwick */
switch (msgtype) {
case DNS_DTTYPE_AR: