net/tcp(unbuffered): advance sndseq by +1 because SYN and FIN occupy one sequence number (RFC 793)
This commit is contained in:
parent
d23ad9b9b0
commit
e9ab3adf23
@ -870,6 +870,11 @@ found:
|
|||||||
|
|
||||||
if ((tcp->flags & TCP_CTL) == TCP_SYN)
|
if ((tcp->flags & TCP_CTL) == TCP_SYN)
|
||||||
{
|
{
|
||||||
|
#if !defined(CONFIG_NET_TCP_WRITE_BUFFERS)
|
||||||
|
tcp_setsequence(conn->sndseq, conn->rexmit_seq);
|
||||||
|
#else
|
||||||
|
/* REVISIT for the buffered mode */
|
||||||
|
#endif
|
||||||
tcp_synack(dev, conn, TCP_ACK | TCP_SYN);
|
tcp_synack(dev, conn, TCP_ACK | TCP_SYN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -382,6 +382,25 @@ static void tcp_sendcommon(FAR struct net_driver_s *dev,
|
|||||||
/* Finish the IP portion of the message and calculate checksums */
|
/* Finish the IP portion of the message and calculate checksums */
|
||||||
|
|
||||||
tcp_sendcomplete(dev, tcp);
|
tcp_sendcomplete(dev, tcp);
|
||||||
|
|
||||||
|
#if !defined(CONFIG_NET_TCP_WRITE_BUFFERS)
|
||||||
|
if ((tcp->flags & (TCP_SYN | TCP_FIN)) != 0)
|
||||||
|
{
|
||||||
|
/* Remember sndseq that will be used in case of a possible
|
||||||
|
* SYN or FIN retransmission
|
||||||
|
*/
|
||||||
|
|
||||||
|
conn->rexmit_seq = tcp_getsequence(conn->sndseq);
|
||||||
|
|
||||||
|
/* Advance sndseq by +1 because SYN and FIN occupy
|
||||||
|
* one sequence number (RFC 793)
|
||||||
|
*/
|
||||||
|
|
||||||
|
net_incr32(conn->sndseq, 1);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* REVISIT for the buffered mode */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -317,6 +317,11 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
|||||||
* SYNACK.
|
* SYNACK.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_NET_TCP_WRITE_BUFFERS)
|
||||||
|
tcp_setsequence(conn->sndseq, conn->rexmit_seq);
|
||||||
|
#else
|
||||||
|
/* REVISIT for the buffered mode */
|
||||||
|
#endif
|
||||||
tcp_synack(dev, conn, TCP_ACK | TCP_SYN);
|
tcp_synack(dev, conn, TCP_ACK | TCP_SYN);
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
@ -324,6 +329,11 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
|||||||
|
|
||||||
/* In the SYN_SENT state, we retransmit out SYN. */
|
/* In the SYN_SENT state, we retransmit out SYN. */
|
||||||
|
|
||||||
|
#if !defined(CONFIG_NET_TCP_WRITE_BUFFERS)
|
||||||
|
tcp_setsequence(conn->sndseq, conn->rexmit_seq);
|
||||||
|
#else
|
||||||
|
/* REVISIT for the buffered mode */
|
||||||
|
#endif
|
||||||
tcp_synack(dev, conn, TCP_SYN);
|
tcp_synack(dev, conn, TCP_SYN);
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
@ -344,6 +354,11 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
|||||||
|
|
||||||
/* In all these states we should retransmit a FINACK. */
|
/* In all these states we should retransmit a FINACK. */
|
||||||
|
|
||||||
|
#if !defined(CONFIG_NET_TCP_WRITE_BUFFERS)
|
||||||
|
tcp_setsequence(conn->sndseq, conn->rexmit_seq);
|
||||||
|
#else
|
||||||
|
/* REVISIT for the buffered mode */
|
||||||
|
#endif
|
||||||
tcp_send(dev, conn, TCP_FIN | TCP_ACK, hdrlen);
|
tcp_send(dev, conn, TCP_FIN | TCP_ACK, hdrlen);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user