mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 14:58:13 +08:00
net/tcp: send a reset if ack is not acceptable in syn-received state
In SYN-RCVD state, if the ACK is not acceptable, send a reset. Signed-off-by: wenquan1 <wenquan1@xiaomi.com>
This commit is contained in:
+2
-2
@@ -1153,7 +1153,7 @@ FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct net_driver_s *dev,
|
||||
conn->expired = 0;
|
||||
conn->isn = 0;
|
||||
conn->sent = 0;
|
||||
conn->sndseq_max = tcp_getsequence(conn->sndseq);
|
||||
conn->sndseq_max = tcp_getsequence(conn->sndseq) + 1;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_TCP_CC_NEWRENO
|
||||
@@ -1465,7 +1465,7 @@ int tcp_connect(FAR struct tcp_conn_s *conn, FAR const struct sockaddr *addr)
|
||||
conn->expired = 0;
|
||||
conn->isn = 0;
|
||||
conn->sent = 0;
|
||||
conn->sndseq_max = tcp_getsequence(conn->sndseq);
|
||||
conn->sndseq_max = tcp_getsequence(conn->sndseq) + 1;
|
||||
#endif
|
||||
|
||||
/* Save initial sndseq to rexmit_seq, otherwise it will be zero */
|
||||
|
||||
+7
-1
@@ -1056,7 +1056,9 @@ found:
|
||||
* bytes
|
||||
*/
|
||||
|
||||
/* RFC793,p72~p73 In states from ESTABLISHED to LASTACK:"If the
|
||||
/* RFC793, p72~p73 1) In SYN-RCVD state, if the ACK is not
|
||||
* acceptable, send a reset.
|
||||
* 2)In states from ESTABLISHED to LASTACK:"If the
|
||||
* ACK acks something not yet sent (SEG.ACK > SND.NXT) then send
|
||||
* an ACK, drop the segment, and return."
|
||||
*/
|
||||
@@ -1067,6 +1069,10 @@ found:
|
||||
tcp_send(dev, conn, TCP_ACK, tcpiplen);
|
||||
return;
|
||||
}
|
||||
else if ((conn->tcpstateflags & TCP_STATE_MASK) == TCP_SYN_RCVD)
|
||||
{
|
||||
goto reset;
|
||||
}
|
||||
}
|
||||
|
||||
if (lasttxunacked == 0)
|
||||
|
||||
Reference in New Issue
Block a user