diff --git a/net/tcp/tcp_conn.c b/net/tcp/tcp_conn.c index b6d3d95841a..6890d6128e4 100644 --- a/net/tcp/tcp_conn.c +++ b/net/tcp/tcp_conn.c @@ -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 */ diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index 46f035ae2a6..e9c51f793e5 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -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)