From 19843f6c9d60f6995af7cc400e66a7d52c0a9b3f Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Wed, 22 Jan 2025 10:42:29 +0000 Subject: [PATCH] Include destination address port number in query logging When query logging is enabled, named will now include the destination address port in the logged message. Example messages for before and after this change: before: client @0x7608b2026000 10.53.0.1#52136 (example.test): query: example.test IN A +E(0)K (10.53.0.1) after: client @0x729bf5c26000 10.53.0.1#35976 (example.test): query: example.test IN A +E(0)K (10.53.0.1#53) --- lib/ns/query.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ns/query.c b/lib/ns/query.c index 5e74609fc3..e2c4a67c51 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -11603,7 +11603,7 @@ log_query(ns_client_t *client, unsigned int flags, unsigned int extflags) { char namebuf[DNS_NAME_FORMATSIZE]; char typebuf[DNS_RDATATYPE_FORMATSIZE]; char classbuf[DNS_RDATACLASS_FORMATSIZE]; - char onbuf[ISC_NETADDR_FORMATSIZE]; + char sabuf[ISC_SOCKADDR_FORMATSIZE]; char ecsbuf[NS_CLIENT_ECS_FORMATSIZE] = { 0 }; char flagsbuf[NS_CLIENT_FLAGS_FORMATSIZE] = { 0 }; dns_rdataset_t *rdataset; @@ -11618,7 +11618,7 @@ log_query(ns_client_t *client, unsigned int flags, unsigned int extflags) { dns_name_format(client->query.qname, namebuf, sizeof(namebuf)); dns_rdataclass_format(rdataset->rdclass, classbuf, sizeof(classbuf)); dns_rdatatype_format(rdataset->type, typebuf, sizeof(typebuf)); - isc_netaddr_format(&client->destaddr, onbuf, sizeof(onbuf)); + isc_sockaddr_format(&client->destsockaddr, sabuf, sizeof(sabuf)); if (HAVEECS(client)) { ns_client_log_ecs(client, ecsbuf, sizeof(ecsbuf)); @@ -11628,7 +11628,7 @@ log_query(ns_client_t *client, unsigned int flags, unsigned int extflags) { ns_client_log(client, NS_LOGCATEGORY_QUERIES, NS_LOGMODULE_QUERY, level, "query: %s %s %s %s (%s)%s", namebuf, classbuf, typebuf, - flagsbuf, onbuf, ecsbuf); + flagsbuf, sabuf, ecsbuf); } static void