2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

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)
This commit is contained in:
Aram Sargsyan
2025-01-22 10:42:29 +00:00
committed by Arаm Sаrgsyаn
parent f8802cbfa0
commit 19843f6c9d

View File

@@ -11603,7 +11603,7 @@ log_query(ns_client_t *client, unsigned int flags, unsigned int extflags) {
char namebuf[DNS_NAME_FORMATSIZE]; char namebuf[DNS_NAME_FORMATSIZE];
char typebuf[DNS_RDATATYPE_FORMATSIZE]; char typebuf[DNS_RDATATYPE_FORMATSIZE];
char classbuf[DNS_RDATACLASS_FORMATSIZE]; char classbuf[DNS_RDATACLASS_FORMATSIZE];
char onbuf[ISC_NETADDR_FORMATSIZE]; char sabuf[ISC_SOCKADDR_FORMATSIZE];
char ecsbuf[NS_CLIENT_ECS_FORMATSIZE] = { 0 }; char ecsbuf[NS_CLIENT_ECS_FORMATSIZE] = { 0 };
char flagsbuf[NS_CLIENT_FLAGS_FORMATSIZE] = { 0 }; char flagsbuf[NS_CLIENT_FLAGS_FORMATSIZE] = { 0 };
dns_rdataset_t *rdataset; 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_name_format(client->query.qname, namebuf, sizeof(namebuf));
dns_rdataclass_format(rdataset->rdclass, classbuf, sizeof(classbuf)); dns_rdataclass_format(rdataset->rdclass, classbuf, sizeof(classbuf));
dns_rdatatype_format(rdataset->type, typebuf, sizeof(typebuf)); 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)) { if (HAVEECS(client)) {
ns_client_log_ecs(client, ecsbuf, sizeof(ecsbuf)); 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, ns_client_log(client, NS_LOGCATEGORY_QUERIES, NS_LOGMODULE_QUERY, level,
"query: %s %s %s %s (%s)%s", namebuf, classbuf, typebuf, "query: %s %s %s %s (%s)%s", namebuf, classbuf, typebuf,
flagsbuf, onbuf, ecsbuf); flagsbuf, sabuf, ecsbuf);
} }
static void static void