net: tcp: Acknowledge FIN packets in TIMED_WAIT state
In case TCP stack enters TIMED_WAIT state (after receiving FIN/ACK reply from peer), it should stil be ready to reply with ACK for any consecutive FIN attempts. Othewise, in case the final ACK from Zephyr side is lost, the connection is not properly closed on the other end, and peer keeps retransmitting the final FIN packet. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
28fb1a5f39
commit
2bd00e65ba
1 changed files with 8 additions and 0 deletions
|
@ -2230,6 +2230,14 @@ next_state:
|
|||
}
|
||||
break;
|
||||
case TCP_TIME_WAIT:
|
||||
/* Acknowledge any FIN attempts, in case retransmission took
|
||||
* place.
|
||||
*/
|
||||
if (th && (FL(&fl, ==, (FIN | ACK), th_seq(th) + 1 == conn->ack) ||
|
||||
FL(&fl, ==, FIN, th_seq(th) + 1 == conn->ack))) {
|
||||
tcp_out(conn, ACK);
|
||||
}
|
||||
|
||||
k_work_reschedule_for_queue(
|
||||
&tcp_work_q, &conn->timewait_timer,
|
||||
K_MSEC(CONFIG_NET_TCP_TIME_WAIT_DELAY));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue