]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Rename dns_message_logfmtpacket()
authorMichał Kępień <michal@isc.org>
Tue, 31 Dec 2024 04:40:48 +0000 (05:40 +0100)
committerMichał Kępień <michal@isc.org>
Tue, 31 Dec 2024 04:40:48 +0000 (05:40 +0100)
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.

lib/dns/include/dns/message.h
lib/dns/message.c
lib/dns/resolver.c

index e711dacbee931fc80050d41ef6dc73c3e74b718a..1376b5d5a46b4c26fbe1dd8bf6467dadee0d4613 100644 (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
index eeba3e1fa3bee1aec9f4ca2c0f91b22c157ac6be..1609796f73a376df098d3b76fe98dcbfbf18895e 100644 (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,
index 2ce4d52cbbd33edf99b8c91ddb96cf83f476d6fb..dcf02145c3827b5fbc9b39db9beb39b5872273b0 100644 (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);