Bug 2174 - m_rWnd not updated when segments without ACK are received
m_rWnd not updated when segments without ACK are received
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: tcp
pre-release
PC Linux
: P5 minor
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-01 11:11 UTC by natale.patriciello
Modified: 2015-09-04 00:22 UTC (History)
3 users (show)

See Also:


Attachments
Patch to fix the problem (987 bytes, patch)
2015-09-01 11:15 UTC, natale.patriciello
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description natale.patriciello 2015-09-01 11:11:58 UTC
The incriminated code is:

  // Update Rx window size, i.e. the flow control window
  if (tcpHeader.GetFlags () & TcpHeader::ACK)
    {
      UpdateWindowSize (tcpHeader);
    }

In one hand, it is correct because UpdateWindowSize manages also the scale of the window (if WindowScale is present), and so it should not be called when a SYN or SYN-ACK is received. However, this leaves m_rWnd set to 0 for SYN and SYN-ACK segments. The correct code would be:

  // Update Rx window size, i.e. the flow control window
  if (tcpHeader.GetFlags () & TcpHeader::ACK)
    {
      UpdateWindowSize (tcpHeader);
    }
  else if (tcpHeader.GetFlags () & TcpHeader::SYN)
    {
      /* The window field in a segment where the SYN bit is set (i.e., a <SYN>
       * or <SYN,ACK>) MUST NOT be scaled (from RFC 7323 page 9). But should be
       * saved anyway..
       */
      m_rWnd = tcpHeader.GetWindowSize ();
    }

Discovered & corrected while investigating on zero window state. Patching is easy.
Comment 1 natale.patriciello 2015-09-01 11:15:11 UTC
Created attachment 2133 [details]
Patch to fix the problem

Added in my testing repo; I plan to add this in mainline after ns3.24 has been released, since (for now) users aren't affected by this problem.
Comment 2 Tom Henderson 2015-09-04 00:22:50 UTC
pushed in changeset 11633:6b74df04cf44