2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

Merge branch '3501-dnstap-response' into 'main'

dnstap query_message field was erroneously set with responses

Closes #3501

See merge request isc-projects/bind9!6701
This commit is contained in:
Evan Hunt
2022-08-31 22:22:44 +00:00
2 changed files with 16 additions and 6 deletions

View File

@@ -1,3 +1,7 @@
5951. [bug] In some cases, the dnstap query_message field was
erroneously set when logging response messages.
[GL #3501]
5950. [func] Implement a feature to set an Extended DNS Error (EDE)
code on responses modified by RPZ. [GL #3410]

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: