Bug 2716 - TCP socket ignoring FIN flag when in FIN_WAIT state
TCP socket ignoring FIN flag when in FIN_WAIT state
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: tcp
ns-3.26
PC Linux
: P3 normal
Assigned To: natale.patriciello
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-03-25 14:31 UTC by Luciano Chaves
Modified: 2017-09-17 18:21 UTC (History)
2 users (show)

See Also:


Attachments
Patch for this bug. (825 bytes, text/plain)
2017-03-25 14:31 UTC, Luciano Chaves
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luciano Chaves 2017-03-25 14:31:24 UTC
Created attachment 2813 [details]
Patch for this bug.

I’ve found and strange behaviour during the TCP close procedure and I think that this may be a bug. In a nutshell, when the TCP socket is on the FIN_WAIT_2 state and receives a packet from peer with valid payload data and both the FIN and ACK flags, the ProcessWait () method was processing the packet data but was ignoring the FIN and ACK flags. Because of that, the state machine get stuck in the FIN_WAIT_2 state.

I’ve changed the first condition on TcpSocketBase::ProcessWait () from:

if (packet->GetSize () > 0 && tcpflags != TcpHeader::ACK)

to 

if (packet->GetSize () > 0 && !(tcpflags & TcpHeader::ACK)) 

and this seems to solve the problem. If I’m right, we only call the ReceivedData () directly if we don’t have the ACK flag to process, otherwise we need to call ReceivedAck () first (which will call ReceivedData later, if necessary). With the proposed change, the case of a packet with data and FIN + ACK will match the third condition, that will process the FIN flag.
Comment 1 Tom Henderson 2017-09-17 18:21:38 UTC
Fixed in 12916:9a7301089ba1