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.
This commit is contained in:
Michał Kępień 2024-12-31 05:40:48 +01:00
parent bafa5d3c2e
commit fa073a0a63
No known key found for this signature in database
3 changed files with 25 additions and 23 deletions

View file

@ -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

View file

@ -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,

View file

@ -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);