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
The following commit(s) were added to refs/heads/master by this push:
new 0ac64ef9614 net/tcp: Do not answer an empty segment in the receive
window.
0ac64ef9614 is described below
commit 0ac64ef96141d9212819d932732961e7988688cb
Author: raiden00pl <[email protected]>
AuthorDate: Sat Nov 21 09:05:05 2026 +0100
net/tcp: Do not answer an empty segment in the receive window.
tcp_input() answered every segment with SEQ above RCV.NXT with an ACK,
also one without data, SYN or FIN. When both ends have unacknowledged
data, their ACKs answer each other without end; over the loopback device
this never leaves devif_loopback(). RFC 9293, 3.10.7.4: an empty segment
with RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND is acceptable. Pass its ACK
to the connection and do not answer it.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: raiden00pl <[email protected]>
---
net/tcp/tcp_input.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c
index ad0caa3b3a6..e3068fce26f 100644
--- a/net/tcp/tcp_input.c
+++ b/net/tcp/tcp_input.c
@@ -1466,6 +1466,25 @@ skip_rtt:
return;
}
}
+ else if (((conn->tcpstateflags & TCP_STATE_MASK) <=
+ TCP_FIN_WAIT_2) && dev->d_len == 0 &&
+ (tcp->flags & (TCP_SYN | TCP_FIN)) == 0 &&
+ TCP_SEQ_LT(seq, conn->rcv_adv))
+ {
+ /* 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.
+ */
+
+ 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)
{
tcp_recvwindow_loss(dev, conn);