document choice for UDP buffer management

This commit is contained in:
yrutschle 2021-01-09 15:24:31 +01:00
parent 368f286ce5
commit ac3b43d4bd

View File

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