From: Alan T. DeKok Date: Mon, 19 May 2025 19:26:58 +0000 (-0500) Subject: if we're not using the packet contents, don't call rad_recv() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1b7701240d9eda90b54848dd67a2624a87063828;p=thirdparty%2Ffreeradius-server.git 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. --- diff --git a/src/main/listen.c b/src/main/listen.c index d7152e5bf1..2af149144c 100644 --- a/src/main/listen.c +++ b/src/main/listen.c @@ -275,13 +275,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);