From: Michał Kępień Date: Tue, 31 Dec 2024 04:40:48 +0000 (+0100) Subject: Rename dns_message_logfmtpacket() X-Git-Tag: v9.21.4~9^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa073a0a63194c1a0cbd92ea19be28ee8e1aef24;p=thirdparty%2Fbind9.git Rename dns_message_logfmtpacket() Since dns_message_logfmtpacket() needs to be provided with both "from" and "to" socket addresses, rename it to dns_message_logpacketfromto() so that its name better conveys its purpose. Clean up the code comments for that function. --- diff --git a/lib/dns/include/dns/message.h b/lib/dns/include/dns/message.h index e711dacbee9..1376b5d5a46 100644 --- a/lib/dns/include/dns/message.h +++ b/lib/dns/include/dns/message.h @@ -1401,28 +1401,29 @@ dns_message_logpacket(dns_message_t *message, const char *description, isc_logmodule_t module, int level, isc_mem_t *mctx); void -dns_message_logfmtpacket(dns_message_t *message, const char *description, - const isc_sockaddr_t *from, const isc_sockaddr_t *to, - isc_logcategory_t category, isc_logmodule_t module, - int level, isc_mem_t *mctx); +dns_message_logpacketfromto(dns_message_t *message, const char *description, + const isc_sockaddr_t *from, + const isc_sockaddr_t *to, + isc_logcategory_t category, isc_logmodule_t module, + int level, isc_mem_t *mctx); /*%< - * Log 'message' at the specified logging parameters. + * Log the provided DNS 'message' using the specified logging parameters, + * prepending it with the given 'description'. * - * For dns_message_logpacket and dns_message_logfmtpacket expect the - * 'description' to end in a newline. + * For dns_message_logpacket(), only the address of the sending socket must be + * provided (in the 'address' parameter). * - * For dns_message_logpacket2 and dns_message_logfmtpacket2 - * 'description' will be emitted at the start of the message followed - * by the formatted address and a newline. + * For dns_message_logpacketfromto(), the addresses of both the sending socket + * ('from') and the receiving socket ('to') must be provided. * * Requires: - * \li message be a valid. - * \li description to be non NULL. - * \li address to be non NULL. - * \li from and to to be non NULL. - * \li category to be valid. - * \li module to be valid. - * \li mctx to be a valid. + * \li 'message' be a valid DNS message. + * \li 'description' to be non-NULL. + * \li 'address' to be non-NULL (dns_message_logpacket() only). + * \li 'from' and 'to' be non-NULL (dns_message_logpacketfromto() only). + * \li 'category' to be a valid logging category. + * \li 'module' to be a valid logging module. + * \li 'mctx' to be a valid memory context. */ isc_result_t diff --git a/lib/dns/message.c b/lib/dns/message.c index eeba3e1fa3b..1609796f73a 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -4738,10 +4738,11 @@ dns_message_logpacket(dns_message_t *message, const char *description, } void -dns_message_logfmtpacket(dns_message_t *message, const char *description, - const isc_sockaddr_t *from, const isc_sockaddr_t *to, - isc_logcategory_t category, isc_logmodule_t module, - int level, isc_mem_t *mctx) { +dns_message_logpacketfromto(dns_message_t *message, const char *description, + const isc_sockaddr_t *from, + const isc_sockaddr_t *to, + isc_logcategory_t category, isc_logmodule_t module, + int level, isc_mem_t *mctx) { REQUIRE(from != NULL && to != NULL); logfmtpacket(message, description, from, to, category, module, diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 2ce4d52cbbd..dcf02145c38 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -2709,7 +2709,7 @@ resquery_send(resquery_t *query) { /* * Log the outgoing packet. */ - dns_message_logfmtpacket( + dns_message_logpacketfromto( fctx->qmessage, "sending packet to", NULL, &query->addrinfo->sockaddr, DNS_LOGCATEGORY_RESOLVER, DNS_LOGMODULE_PACKETS, ISC_LOG_DEBUG(11), fctx->mctx); @@ -9729,7 +9729,7 @@ rctx_logpacket(respctx_t *rctx) { isc_buffer_t zb; #endif /* HAVE_DNSTAP */ - dns_message_logfmtpacket( + dns_message_logpacketfromto( rctx->query->rmessage, "received packet from", &rctx->query->addrinfo->sockaddr, NULL, DNS_LOGCATEGORY_RESOLVER, DNS_LOGMODULE_PACKETS, ISC_LOG_DEBUG(10), fctx->mctx);