Commit c5b12a38be for bind
commit c5b12a38be271b81f18279198b0fd56448322b43
Author: OndÅ™ej Surý <ondrej@isc.org>
Date: Sun Oct 18 09:24:35 2026 +0200
Fix the UDP receive buffer size for libuv recvmmsg
libuv splits the UDP receive buffer into UV__UDP_DGRAM_MAXSIZE
(64 * 1024) byte chunks, so a buffer of 20 * UINT16_MAX bytes only
holds 19 chunks and the last datagram slot of every recvmmsg call went
unused. Size the buffer as 20 * 64 KiB so that all 20 slots are
usable.
diff --git a/lib/isc/netmgr/netmgr-int.h b/lib/isc/netmgr/netmgr-int.h
index 8e6e605033..fa5797a26b 100644
--- a/lib/isc/netmgr/netmgr-int.h
+++ b/lib/isc/netmgr/netmgr-int.h
@@ -49,10 +49,14 @@
*/
#if HAVE_DECL_UV_UDP_MMSG_CHUNK
/*
- * The value 20 here is UV__MMSG_MAXWIDTH taken from the current libuv source,
- * libuv will not receive more that 20 datagrams in a single recvmmsg call.
- */
-#define ISC_NETMGR_UDP_RECVBUF_SIZE (20 * UINT16_MAX)
+ * libuv splits the receive buffer into chunks of UV__UDP_DGRAM_MAXSIZE
+ * (64 * 1024) bytes and will not receive more than UV__MMSG_MAXWIDTH (20)
+ * datagrams in a single recvmmsg call; both values are taken from the
+ * current libuv source. The buffer size must be a multiple of the chunk
+ * size, otherwise the remainder is wasted: 20 * UINT16_MAX would only fit
+ * 19 chunks.
+ */
+#define ISC_NETMGR_UDP_RECVBUF_SIZE (20 * (64 * 1024))
#else
/*
* A single DNS message size