From 3304c694c8165e000d235e764cc3e0a520699235 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Fri, 26 Aug 2022 17:58:55 -0700 Subject: [PATCH 1/2] quote addresses in YAML output YAML strings should be quoted if they contain colon characters. Since IPv6 addresses do, we now quote the query_address and response_address strings in all YAML output. (cherry picked from commit 66eaf6bb738cd146662f6198f4d720dfb06bb9da) --- bin/dig/dig.c | 4 ++-- bin/tools/dnstap-read.c | 4 ++-- bin/tools/mdig.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/dig/dig.c b/bin/dig/dig.c index 4c62d0c5f9..035b62dada 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -790,7 +790,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg, strlcat(sockstr, "0", sizeof(sockstr)); } - printf(" response_address: %s\n", sockstr); + printf(" response_address: \"%s\"\n", sockstr); printf(" response_port: %u\n", sport); } @@ -807,7 +807,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg, strlcat(sockstr, "0", sizeof(sockstr)); } - printf(" query_address: %s\n", sockstr); + printf(" query_address: \"%s\"\n", sockstr); printf(" query_port: %u\n", sport); } diff --git a/bin/tools/dnstap-read.c b/bin/tools/dnstap-read.c index dc7ae919ff..f6abeeb238 100644 --- a/bin/tools/dnstap-read.c +++ b/bin/tools/dnstap-read.c @@ -266,7 +266,7 @@ print_yaml(dns_dtdata_t *dt) { (void)inet_ntop(ip->len == 4 ? AF_INET : AF_INET6, ip->data, buf, sizeof(buf)); - printf(" query_address: %s\n", buf); + printf(" query_address: \"%s\"\n", buf); } if (m->has_response_address) { @@ -275,7 +275,7 @@ print_yaml(dns_dtdata_t *dt) { (void)inet_ntop(ip->len == 4 ? AF_INET : AF_INET6, ip->data, buf, sizeof(buf)); - printf(" response_address: %s\n", buf); + printf(" response_address: \"%s\"\n", buf); } if (m->has_query_port) { diff --git a/bin/tools/mdig.c b/bin/tools/mdig.c index 8ab55bf052..cd1488fd55 100644 --- a/bin/tools/mdig.c +++ b/bin/tools/mdig.c @@ -330,7 +330,7 @@ recvresponse(isc_task_t *task, isc_event_t *event) { if (hash != NULL) { *hash = '\0'; } - printf(" response_address: %s\n", sockstr); + printf(" response_address: \"%s\"\n", sockstr); printf(" response_port: %u\n", sport); } @@ -341,7 +341,7 @@ recvresponse(isc_task_t *task, isc_event_t *event) { if (hash != NULL) { *hash = '\0'; } - printf(" query_address: %s\n", sockstr); + printf(" query_address: \"%s\"\n", sockstr); printf(" query_port: %u\n", sport); } From 3ea267f29db8ad5961d558d86ad9ef847271ea43 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Fri, 26 Aug 2022 18:00:50 -0700 Subject: [PATCH 2/2] CHANGES for [GL #3511] (cherry picked from commit f72bf1375a23d5dc0c622f07016186a9d36877f5) --- CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index a40859aa72..58a84055f4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +5952. [bug] Use quotes around address strings in YAML output. + [GL #3511] + 5951. [bug] In some cases, the dnstap query_message field was erroneously set when logging response messages. [GL #3501]