This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit f6f5659c5224d835709a2c75e634978de3aa9fa0
Author: Marco Casaroli <[email protected]>
AuthorDate: Wed Nov 25 19:38:54 2026 +0100

    net/tcp: Send no RST when a connection in SYN_RCVD times out.
    
    When the SYN-ACK retries of a connection in TCP_SYN_RCVD end, tcp_timer()
    sends a RST to the source address of the SYN and frees the connection.
    The peer never answered the SYN-ACK, so the RST has nothing to reset.
    When the source address of the SYN is spoofed, the RST goes to a host
    that sent nothing: each SYN of a flood gives one more packet to a third
    party.
    
    Free the connection and send nothing, as Linux does when a request in
    its SYN queue times out.  RFC 9293 does not ask for a RST here.  A
    connection that this side opened, and an established connection, still
    send a RST when their retries end.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 net/tcp/tcp_timer.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/tcp/tcp_timer.c b/net/tcp/tcp_timer.c
index ca3ab604c8e..3b3e8f5f5c4 100644
--- a/net/tcp/tcp_timer.c
+++ b/net/tcp/tcp_timer.c
@@ -556,6 +556,9 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct 
tcp_conn_s *conn)
                * the ACK is received, completing the 3-way handshake.  But if
                * the retry count elapsed, then we must assume that no ACK is
                * forthcoming and terminate the attempted connection.
+               *
+               * Send no reset: the peer never answered, and the source
+               * address of the SYN can be spoofed.
                */
 
               if (conn->tcpstateflags == TCP_SYN_RCVD &&
@@ -564,10 +567,6 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct 
tcp_conn_s *conn)
                   conn->tcpstateflags = TCP_CLOSED;
                   ninfo("TCP state: TCP_SYN_RCVD->TCP_CLOSED\n");
 
-                  /* We also send a reset packet to the remote host. */
-
-                  tcp_send(dev, conn, TCP_RST | TCP_ACK, hdrlen);
-
                   /* Finally, we must free this TCP connection structure */
 
                   conn->crefs = 0;

Reply via email to