tcp_rexmit: advance conn->sndseq

Otherwise, we use an old sequence number when sending
non-data segment. (eg. window update)
The peer might consider such a segment stale and ignore.
This commit is contained in:
YAMAMOTO Takashi 2021-07-27 13:47:18 +09:00 committed by Xiang Xiao
parent 87c5cc1a5d
commit e53f989997

View File

@ -319,11 +319,18 @@ void tcp_rexmit(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
if (dev->d_sndlen > 0 && conn->tx_unacked > 0)
#endif
{
uint32_t seq;
/* We always set the ACK flag in response packets adding the length of
* the IP and TCP headers.
*/
tcp_send(dev, conn, TCP_ACK | TCP_PSH, dev->d_sndlen + hdrlen);
/* Advance sndseq */
seq = tcp_getsequence(conn->sndseq);
tcp_setsequence(conn->sndseq, seq + dev->d_sndlen);
}
/* If there is no data to send, just send out a pure ACK if one is