Bug 2258

Summary: Discarded segments update RTT as well as TCP options
Product: ns-3 Reporter: natale.patriciello
Component: tcpAssignee: natale.patriciello
Status: RESOLVED FIXED    
Severity: enhancement CC: ns-bugs, tomh
Priority: P5    
Version: pre-release   
Hardware: PC   
OS: Linux   
Attachments: Patch

Description natale.patriciello 2016-01-12 06:23:19 UTC
Created attachment 2226 [details]
Patch

In DoForwardUp, we have this code:

  m_rxTrace (packet, tcpHeader, this);

  ReadOptions (tcpHeader);

  if (tcpHeader.GetFlags () & TcpHeader::ACK)
    {
      EstimateRtt (tcpHeader);
    }

  // Discard fully out of range data packets
  if (packet->GetSize ()
      && OutOfRange (tcpHeader.GetSequenceNumber (), tcpHeader.GetSequenceNumber () + packet->GetSize ()))
    {
      NS_LOG_LOGIC ("At state " << TcpStateName[m_state] <<
                    " received packet of seq [" << tcpHeader.GetSequenceNumber () <<
                    ":" << tcpHeader.GetSequenceNumber () + packet->GetSize () <<
                    ") out of range [" << m_rxBuffer->NextRxSequence () << ":" <<
                    m_rxBuffer->MaxRxSequence () << ")");
      // Acknowledgement should be sent for all unacceptable packets (RFC793, p.69)
      if (m_state == ESTABLISHED && !(tcpHeader.GetFlags () & TcpHeader::RST))
        {
          SendEmptyPacket (TcpHeader::ACK);
        }
      return;
    }


clearly, a discarded segment should not be allowed to update both rtt and options.

Trivially patched to move up the discard part.

Waiting for comments before applying.
Comment 1 Tom Henderson 2016-01-12 10:02:47 UTC
I agree with the patch.
Comment 2 natale.patriciello 2016-01-22 08:58:10 UTC
Changeset 11827:26cef97eafa8