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

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

commit eaaea8fea435befc8c9453b7d37d7c6c01e89855
Author: Marco Casaroli <[email protected]>
AuthorDate: Fri Nov 20 13:54:09 2026 +0100

    net/tcp: Process a segment without data after a gap.
    
    0ac64ef9614 ("net/tcp: Do not answer an empty segment in the receive
    window") stops the ACK that tcp_input() gave to a segment without data,
    SYN or FIN in the receive window after the next expected sequence
    number: an ACK or a window update of a peer whose segment was lost.
    But it gives only a new ACK to the connection and returns before the
    window update and the state machine.  RFC 9293, section 3.10.7.4,
    processes such a segment in full.
    
    So the window that such a segment opens is not used: the sender waits
    for its next zero window probe.  An ACK of our FIN in such a segment
    does not move FIN_WAIT_1 to FIN_WAIT_2, and in SYN_RCVD an ACK of our
    SYN-ACK does not complete the handshake.
    
    Such a segment now goes on to the window update and the state machine,
    as a segment at the next expected sequence number does.  It still gets
    no ACK.  A segment at or after rcv_adv, the right edge of the window
    that we advertised, is not in the window: it still gets the ACK and is
    dropped, so it cannot move snd_wl1 ahead of the peer.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 net/tcp/tcp_input.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c
index 8998c4c2fd7..6407c63ac1a 100644
--- a/net/tcp/tcp_input.c
+++ b/net/tcp/tcp_input.c
@@ -1482,17 +1482,9 @@ skip_rtt:
             {
               /* A segment without data, SYN or FIN is acceptable if
                * RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND (RFC 9293, 3.10.7.4).
-               * Pass a new ACK to the application, but do not answer it.
+               * It goes on to the window update and the state machine, and
+               * gets no ACK.
                */
-
-              if ((flags & TCP_ACKDATA) != 0)
-                {
-                  dev->d_sndlen = 0;
-                  tcp_appsend(dev, conn,
-                              tcp_callback(dev, conn, TCP_ACKDATA));
-                }
-
-              return;
             }
           else if ((conn->tcpstateflags & TCP_STATE_MASK) <= TCP_FIN_WAIT_2)
             {

Reply via email to