From 28a1e473767819ac73b066df303df7fda5382081 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Mon, 19 May 2025 14:26:58 -0500 Subject: [PATCH] if we're not using the packet contents, don't call rad_recv() which avoids all of the issues with reading partial packets from a TCP socket. And then also means that we avoid issues with reading the TCP listen() socket versus the TCP accept() socket. --- src/main/listen.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/listen.c b/src/main/listen.c index 3cbd4f88f9..68da367dc1 100644 --- a/src/main/listen.c +++ b/src/main/listen.c @@ -279,13 +279,19 @@ RADCLIENT *client_listener_find(rad_listen_t *listener, request->listener = listener; request->client = client; - request->packet = rad_recv(NULL, listener->fd, 0x02); /* MSG_PEEK */ + + request->packet = rad_alloc(request, false); if (!request->packet) { /* badly formed, etc */ talloc_free(request); if (DEBUG_ENABLED) ERROR("Receive - %s", fr_strerror()); goto unknown; } - (void) talloc_steal(request, request->packet); + request->packet->src_ipaddr = *ipaddr; + request->packet->src_port = src_port; + request->packet->dst_ipaddr = sock->my_ipaddr; + request->packet->dst_port = sock->my_port; + request->packet->proto = sock->proto; + request->reply = rad_alloc_reply(request, request->packet); if (!request->reply) { talloc_free(request); -- 2.47.3