View | Details | Raw Unified | Return to bug 2068
Collapse All | Expand All

(-)a/src/internet/model/tcp-socket-base.cc (-22 / +13 lines)
 Lines 1166-1173   TcpSocketBase::DoForwardUp (Ptr<Packet> packet, const Address &fromAddress, Link Here 
1166
1166
1167
  m_rxTrace (packet, tcpHeader, this);
1167
  m_rxTrace (packet, tcpHeader, this);
1168
1168
1169
  ReadOptions (tcpHeader);
1170
1171
  if (tcpHeader.GetFlags () & TcpHeader::SYN)
1169
  if (tcpHeader.GetFlags () & TcpHeader::SYN)
1172
    {
1170
    {
1173
      /* The window field in a segment where the SYN bit is set (i.e., a <SYN>
1171
      /* The window field in a segment where the SYN bit is set (i.e., a <SYN>
 Lines 1176-1183   TcpSocketBase::DoForwardUp (Ptr<Packet> packet, const Address &fromAddress, Link Here 
1176
       */
1174
       */
1177
      m_rWnd = tcpHeader.GetWindowSize ();
1175
      m_rWnd = tcpHeader.GetWindowSize ();
1178
1176
1177
      if (tcpHeader.HasOption (TcpOption::WINSCALE) && m_winScalingEnabled)
1178
        {
1179
          ProcessOptionWScale (tcpHeader.GetOption (TcpOption::WINSCALE));
1180
        }
1181
      else
1182
        {
1183
          m_winScalingEnabled = false;
1184
        }
1185
1186
      // Scale initial slow start threshold to the size of the largest possible
1187
      // advertised window (RFC 5681, page 4)
1179
      if (m_tcb->m_initialSsThresh == UINT32_MAX)
1188
      if (m_tcb->m_initialSsThresh == UINT32_MAX)
1180
        {
1189
        {
1190
          // m_sndWindShift is initialized to 0, no problem even if winScale is
1191
          // disabled
1181
          m_tcb->m_initialSsThresh = m_rWnd << m_sndWindShift;
1192
          m_tcb->m_initialSsThresh = m_rWnd << m_sndWindShift;
1182
        }
1193
        }
1183
1194
 Lines 3110-3135   TcpSocketBase::GetAllowBroadcast (void) const Link Here 
3110
}
3121
}
3111
3122
3112
void
3123
void
3113
TcpSocketBase::ReadOptions (const TcpHeader& header)
3114
{
3115
  NS_LOG_FUNCTION (this << header);
3116
3117
  if ((header.GetFlags () & TcpHeader::SYN))
3118
    {
3119
      if (m_winScalingEnabled)
3120
        {
3121
          m_winScalingEnabled = false;
3122
3123
          if (header.HasOption (TcpOption::WINSCALE))
3124
            {
3125
              m_winScalingEnabled = true;
3126
              ProcessOptionWScale (header.GetOption (TcpOption::WINSCALE));
3127
            }
3128
        }
3129
    }
3130
}
3131
3132
void
3133
TcpSocketBase::AddOptions (TcpHeader& header)
3124
TcpSocketBase::AddOptions (TcpHeader& header)
3134
{
3125
{
3135
  NS_LOG_FUNCTION (this << header);
3126
  NS_LOG_FUNCTION (this << header);
(-)a/src/internet/model/tcp-socket-base.h (-14 lines)
 Lines 824-843   protected: Link Here 
824
   */
824
   */
825
  virtual void DoRetransmit (void);
825
  virtual void DoRetransmit (void);
826
826
827
  /**
828
   * \brief Read TCP options from incoming packets
829
   *
830
   * This method sequentially checks each kind of option, and if it
831
   * is present in the header, starts its processing.
832
   *
833
   * To deal with hosts which don't have the option enabled (or
834
   * implemented) we disable all options, and then re-enable them
835
   * if in the packet there is the option itself.
836
   *
837
   * \param tcpHeader the packet's TCP header
838
   */
839
  virtual void ReadOptions (const TcpHeader& tcpHeader);
840
841
  /** \brief Add options to TcpHeader
827
  /** \brief Add options to TcpHeader
842
   *
828
   *
843
   * Test each option, and if it is enabled on our side, add it
829
   * Test each option, and if it is enabled on our side, add it

Return to bug 2068