This is an automated email from the ASF dual-hosted git repository.
xiaoxiang 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 da43a2e53bb tcp_timer.c: send TCP_RST when keepalive timeout
da43a2e53bb is described below
commit da43a2e53bbd61f456dc434f9770650f66e94a8f
Author: zhanghongyu <[email protected]>
AuthorDate: Fri Aug 15 10:19:41 2025 +0800
tcp_timer.c: send TCP_RST when keepalive timeout
The RFC requires sending an TCP_RST packet in this scenario, so to better
comply with the standard definition, the sending of TCP_RST is added.
Signed-off-by: zhanghongyu <[email protected]>
---
net/tcp/tcp_timer.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/net/tcp/tcp_timer.c b/net/tcp/tcp_timer.c
index 368a3379b20..33c70aff0f5 100644
--- a/net/tcp/tcp_timer.c
+++ b/net/tcp/tcp_timer.c
@@ -695,7 +695,15 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct
tcp_conn_s *conn)
devif_conn_event(conn->dev, TCP_ABORT,
conn->sconn.list);
- tcp_stop_monitor(conn, TCP_ABORT);
+
+ /* We also send a reset packet to the remote host. */
+
+ tcp_send(dev, conn, TCP_RST | TCP_ACK, hdrlen);
+
+ /* Stop the timer work */
+
+ conn->keeptimer = 0;
+ conn->timer = 0;
}
else
{