net: tcp: Invalid transition from FIN_WAIT_1 to CLOSE_WAIT

We incorrectly changed the state from FIN_WAIT_1 to CLOSE_WAIT.
This caused ACK be sent in CLOSE_WAIT state when the connection
was closed by peer. Sending ACK in this state is not allowed
according to RFC. The connection was still closed but slightly
wrong way.

Jira: ZEP-1961

Change-Id: Ie4aa6818128d4190230b679e26ac9630c7d45d69
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2017-03-23 17:55:46 +02:00
commit b3e5de641d

View file

@ -833,7 +833,10 @@ NET_CONN_CB(tcp_established)
* LAST_ACK state
*/
context->tcp->fin_rcvd = 1;
net_tcp_change_state(context->tcp, NET_TCP_CLOSE_WAIT);
if (net_tcp_get_state(context->tcp) == NET_TCP_ESTABLISHED) {
net_tcp_change_state(context->tcp, NET_TCP_CLOSE_WAIT);
}
context->tcp->send_ack += 1;