Bug 2613

Summary: MaxRxSequence () is sometimes too large
Product: ns-3 Reporter: Christoph Döpmann <doepmanc>
Component: tcpAssignee: natale.patriciello
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs
Priority: P3    
Version: ns-3-dev   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 2559    
Attachments: proposed patch

Description Christoph Döpmann 2017-01-05 16:19:39 UTC

    
Comment 1 Christoph Döpmann 2017-01-05 16:21:35 UTC
Created attachment 2734 [details]
proposed patch
Comment 2 Christoph Döpmann 2017-01-05 16:21:56 UTC
Hi,

there seems to be an issue in the calculation of MaxRxSequence () within TcpRxBuffer. The problem is that, if there is data in the buffer, the maximum sequence number is calculated as follows:

  else if (m_data.size ())
    { // No data allowed beyond Rx window allowed
      return m_data.begin ()->first + SequenceNumber32 (m_maxBuffer);
    }

However, this does not handle the case where the first element in the buffer is not actually in order, but arrived after a gap in the sequence space. In this case, the maximum buffer size should of course count from the sequence number we are expecting (the gap), so we save the space for the data that will be retransmitted later. My fix thus is:

  else if (m_data.size () && m_nextRxSeq > m_data.begin ()->first)
    { // No data allowed beyond Rx window allowed
      return m_data.begin ()->first + SequenceNumber32 (m_maxBuffer);
    }

Without this change, we can run into situations in which MaxRxSequence () returns a sequence number that is greater than m_nextRxSeq + m_maxBuffer.
Comment 3 natale.patriciello 2017-02-03 08:27:08 UTC
Moved to last call state, I'd like to merge this with the ADV.WND patch.
Comment 4 natale.patriciello 2017-02-06 07:27:26 UTC
Fixed in 12671:4e3671db908e, thank you