net: tcp2: Fix FIN+ACK retransmissions in ESTABLISHED

In order to avoid retransmissions from the peer's side
on full-close, handle states properly.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
This commit is contained in:
Ravi kumar Veeramally 2020-04-24 15:49:29 +03:00 committed by Jukka Rissanen
parent 0aebbb1e06
commit 91de50cb37
1 changed files with 9 additions and 3 deletions

View File

@ -913,11 +913,17 @@ next_state:
case TCP_ESTABLISHED:
/* full-close */
if (th && FL(&fl, ==, (FIN | ACK), th_seq(th) == conn->ack)) {
conn_ack(conn, + 1);
tcp_out(conn, FIN | ACK);
next = TCP_LAST_ACK;
break;
} else if (th && FL(&fl, ==, FIN, th_seq(th) == conn->ack)) {
conn_ack(conn, + 1);
tcp_out(conn, ACK);
next = TCP_CLOSE_WAIT;
break;
}
if (len) {
if (th_seq(th) == conn->ack) {
tcp_data_get(conn, pkt);
@ -927,13 +933,13 @@ next_state:
tcp_out(conn, ACK); /* peer has resent */
}
}
break; /* TODO: Catch all the rest here */
break;
case TCP_CLOSE_WAIT:
tcp_out(conn, FIN | ACK);
tcp_out(conn, FIN);
next = TCP_LAST_ACK;
break;
case TCP_LAST_ACK:
if (FL(&fl, ==, ACK, th_seq(th) == conn->ack)) {
if (th && FL(&fl, ==, ACK, th_seq(th) == conn->ack)) {
tcp_send_timer_cancel(conn);
next = TCP_CLOSED;
}