From ac3b43d4bd52e4f7650896b6d4cae42904237480 Mon Sep 17 00:00:00 2001
From: yrutschle <git1@rutschle.net>
Date: Sat, 9 Jan 2021 15:24:31 +0100
Subject: [PATCH] document choice for UDP buffer management

---
 sslh-fork.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sslh-fork.c b/sslh-fork.c
index ff65f38..1d9ae6e 100644
--- a/sslh-fork.c
+++ b/sslh-fork.c
@@ -260,7 +260,9 @@ int udp_extern_forward(int sockfd) {
     ssize_t len;
     socklen_t addrlen;
     int res, target, out = -1;
-    char data[65536]; /* TODO what's right, here? */
+    char data[65536]; /* Theoritical max is 65507 (https://en.wikipedia.org/wiki/User_Datagram_Protocol).
+                         This will do.  Dynamic allocation is possible with the MSG_PEEK flag in recvfrom(2), but that'd imply
+                         malloc/free overhead for each packet, when really 64K is not that much */
 
     fprintf(stderr, "recvfrom(%d)\n", getpid());
     addrlen = sizeof(src_addr);