net/tcp: Reset the conn when receiving a ACK in the SYN_SENT state.
According to RFC793, Section 3.4, Page 33. In the SYN_SENT state, if receive a ACK without the SYN, we should reset the connection and retransmit the SYN. Signed-off-by: liqinhui <liqinhui@xiaomi.com>
This commit is contained in:
parent
243148241a
commit
4c85805be0
|
@ -1174,6 +1174,27 @@ found:
|
|||
seq = tcp_getsequence(tcp->seqno);
|
||||
rcvseq = tcp_getsequence(conn->rcvseq);
|
||||
|
||||
/* According to RFC793, Section 3.4, Page 33.
|
||||
* In the SYN_SENT state, if receive a ACK without SYN,
|
||||
* we should reset the connection and retransmit the SYN.
|
||||
*/
|
||||
|
||||
if (((conn->tcpstateflags & TCP_STATE_MASK) == TCP_SYN_SENT) &&
|
||||
((tcp->flags & TCP_SYN) == 0 && (tcp->flags & TCP_ACK) != 0))
|
||||
{
|
||||
/* Send the RST to close the half-open connection. */
|
||||
|
||||
tcp_reset(dev, conn);
|
||||
|
||||
/* Retransmit the SYN as soon as possible in order to establish
|
||||
* the tcp connection.
|
||||
*/
|
||||
|
||||
tcp_update_retrantimer(conn, 1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (seq != rcvseq)
|
||||
{
|
||||
/* Trim the head of the segment */
|
||||
|
|
Loading…
Reference in New Issue