This is an automated email from the ASF dual-hosted git repository.
archer 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 d5d9c501fa tcp_input: if tcp->req > recvreq, send ack only when state
is TCP_ESTABLISHED
d5d9c501fa is described below
commit d5d9c501fa794b4311d4c7a3601e37b6aef1ce30
Author: zhanghongyu <[email protected]>
AuthorDate: Thu Aug 31 19:31:31 2023 +0800
tcp_input: if tcp->req > recvreq, send ack only when state is
TCP_ESTABLISHED
we will drop packet when tcp_close_eventhandler
is register and invoke by tcp_input. then we will always early return and
never stop, the peer will only close the connection if we send reset packet.
precondition:
close -> register tcp_close_eventhandler;
tcp_input -> tcp_callback(TCP_NEWDATA) -> devif_conn_event ->
tcp_close_eventhandler
-> flags &= ~TCP_NEWDATA -> NOT entry tcp_data_event -> conn->recvreq NOT
increase
old flow:
tcp_input -> tcp->seqno greater than conn->rcvseq -> tcp_send(TCP_ACK)
with this patch:
tcp_input -> tcp->seqno greater than conn->rcvseq -> !TCP_ESTABLISHED
-> case TCP_FIN_WAIT_1 -> dev->d_len greater than 0 -> tcp_reset
Signed-off-by: zhanghongyu <[email protected]>
---
net/tcp/tcp_input.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c
index 8b5bcffa29..70b99f345b 100644
--- a/net/tcp/tcp_input.c
+++ b/net/tcp/tcp_input.c
@@ -1214,7 +1214,7 @@ found:
return;
}
}
- else
+ else if ((conn->tcpstateflags & TCP_STATE_MASK) <= TCP_ESTABLISHED)
{
#ifdef CONFIG_NET_TCP_OUT_OF_ORDER
/* Queue out-of-order segments. */