From 1fad8be08d5513ca5e7bcb37f67c4337db82ad67 Mon Sep 17 00:00:00 2001 From: Josh Pelkey Date: Wed, 14 Apr 2010 16:31:55 -0400 Subject: [PATCH 1/5] Bug 876 - Tcp socket does not handle ShutdownRecv correctly --- src/internet-stack/tcp-socket-impl.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/internet-stack/tcp-socket-impl.cc b/src/internet-stack/tcp-socket-impl.cc index 3b59a9496..a618d6fb3 100644 --- a/src/internet-stack/tcp-socket-impl.cc +++ b/src/internet-stack/tcp-socket-impl.cc @@ -674,10 +674,6 @@ TcpSocketImpl::ForwardUp (Ptr packet, Ipv4Address saddr, Ipv4Address dad Address fromAddress = InetSocketAddress (saddr, port); Address toAddress = InetSocketAddress (daddr, m_endPoint->GetLocalPort()); - if (m_shutdownRecv) - { - return; - } TcpHeader tcpHeader; packet->RemoveHeader (tcpHeader); @@ -735,7 +731,10 @@ Actions_t TcpSocketImpl::ProcessEvent (Events_t e) if (saveState < CLOSING && (m_state == CLOSING || m_state == TIMED_WAIT) ) { NS_LOG_LOGIC ("TcpSocketImpl peer closing, send EOF to application"); - NotifyDataRecv (); + if (!m_shutdownRecv) + { + NotifyDataRecv (); + } } if (needCloseNotify && !m_closeNotified) @@ -1296,7 +1295,10 @@ void TcpSocketImpl::NewRx (Ptr p, m_rxAvailable += p->GetSize (); RxBufFinishInsert (tcpHeader.GetSequenceNumber ()); m_rxBufSize += p->GetSize (); - NotifyDataRecv (); + if (!m_shutdownRecv) + { + NotifyDataRecv (); + } if (m_closeNotified) { NS_LOG_LOGIC ("Tcp " << this << " HuH? Got data after closeNotif"); @@ -1392,7 +1394,10 @@ void TcpSocketImpl::NewRx (Ptr p, m_rxAvailable += p->GetSize (); m_rxBufSize += p->GetSize(); RxBufFinishInsert(start); - NotifyDataRecv (); + if (!m_shutdownRecv) + { + NotifyDataRecv (); + } } else { // debug From 4ea41e50a026224015196360b1792417589db933 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Wed, 14 Apr 2010 16:33:25 -0400 Subject: [PATCH 2/5] Bug 833 - OnOffApplication with PacketSocket: sniffs all traffic --- src/applications/onoff/onoff-application.cc | 1 + src/applications/packet-sink/packet-sink.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/src/applications/onoff/onoff-application.cc b/src/applications/onoff/onoff-application.cc index 3bb80f811..c86b279b8 100644 --- a/src/applications/onoff/onoff-application.cc +++ b/src/applications/onoff/onoff-application.cc @@ -133,6 +133,7 @@ void OnOffApplication::StartApplication() // Called at time specified by Start m_socket = Socket::CreateSocket (GetNode(), m_tid); m_socket->Bind (); m_socket->Connect (m_peer); + m_socket->ShutdownRecv (); } // Insure no pending event CancelEvents (); diff --git a/src/applications/packet-sink/packet-sink.cc b/src/applications/packet-sink/packet-sink.cc index b953c24e8..1ddf50c33 100644 --- a/src/applications/packet-sink/packet-sink.cc +++ b/src/applications/packet-sink/packet-sink.cc @@ -96,6 +96,7 @@ void PacketSink::StartApplication() // Called at time specified by Start m_socket = Socket::CreateSocket (GetNode(), m_tid); m_socket->Bind (m_local); m_socket->Listen (); + m_socket->ShutdownSend (); if (addressUtils::IsMulticast (m_local)) { Ptr udpSocket = DynamicCast (m_socket); From ef802c6fbd32ead5419754870aa1c96727440646 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Wed, 14 Apr 2010 16:34:23 -0400 Subject: [PATCH 3/5] Bug 835 - Unlimited receive queues in sockets == evil --- src/node/packet-socket.cc | 2 +- src/node/tcp-socket.cc | 2 +- src/node/udp-socket.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node/packet-socket.cc b/src/node/packet-socket.cc index 07ddee6f4..51b3fc2e4 100644 --- a/src/node/packet-socket.cc +++ b/src/node/packet-socket.cc @@ -43,7 +43,7 @@ PacketSocket::GetTypeId (void) MakeTraceSourceAccessor (&PacketSocket::m_dropTrace)) .AddAttribute ("RcvBufSize", "PacketSocket maximum receive buffer size (bytes)", - UintegerValue (0xffffffffl), + UintegerValue (131072), MakeUintegerAccessor (&PacketSocket::m_rcvBufSize), MakeUintegerChecker ()) ; diff --git a/src/node/tcp-socket.cc b/src/node/tcp-socket.cc index a5ed8e534..29eb0c518 100644 --- a/src/node/tcp-socket.cc +++ b/src/node/tcp-socket.cc @@ -45,7 +45,7 @@ TcpSocket::GetTypeId (void) MakeUintegerChecker ()) .AddAttribute ("RcvBufSize", "TcpSocket maximum receive buffer size (bytes)", - UintegerValue (0xffffffffl), + UintegerValue (131072), MakeUintegerAccessor (&TcpSocket::GetRcvBufSize, &TcpSocket::SetRcvBufSize), MakeUintegerChecker ()) diff --git a/src/node/udp-socket.cc b/src/node/udp-socket.cc index 9f399a346..ee54dbbdf 100644 --- a/src/node/udp-socket.cc +++ b/src/node/udp-socket.cc @@ -39,7 +39,7 @@ UdpSocket::GetTypeId (void) .SetParent () .AddAttribute ("RcvBufSize", "UdpSocket maximum receive buffer size (bytes)", - UintegerValue (0xffffffffl), + UintegerValue (131072), MakeUintegerAccessor (&UdpSocket::GetRcvBufSize, &UdpSocket::SetRcvBufSize), MakeUintegerChecker ()) From 2307b5e56269841cec0675521bba55a6e9912df1 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Wed, 14 Apr 2010 23:11:50 -0700 Subject: [PATCH 4/5] suppress valgrind testing of new nsc test suite --- test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test.py b/test.py index abe6b5f37..fb5fda6e1 100755 --- a/test.py +++ b/test.py @@ -63,6 +63,7 @@ core_kinds = ["bvt", "core", "system", "unit"] # core_valgrind_skip_tests = [ "ns3-tcp-cwnd", + "nsc-tcp-loss", "ns3-tcp-interoperability", ] From 60d5653c3c78f29ef1099a8e2e879453defb82bd Mon Sep 17 00:00:00 2001 From: Mohamed Amine Ismail Date: Thu, 15 Apr 2010 09:32:31 +0200 Subject: [PATCH 5/5] Bug 866 - WiMAX mobility models not aggregated to Node --- examples/wimax/wimax-multicast.cc | 4 ++-- src/devices/wimax/bs-link-manager.cc | 7 ++++--- .../wimax/simple-ofdm-wimax-channel.cc | 19 +++++++------------ src/devices/wimax/simple-ofdm-wimax-phy.cc | 9 ++------- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/examples/wimax/wimax-multicast.cc b/examples/wimax/wimax-multicast.cc index cf3d30066..3074ded7c 100644 --- a/examples/wimax/wimax-multicast.cc +++ b/examples/wimax/wimax-multicast.cc @@ -150,7 +150,7 @@ int main (int argc, char *argv[]) BSPosition = CreateObject (); BSPosition->SetPosition (Vector (1000, 0, 0)); - dev->GetPhy ()->SetMobility (BSPosition); + bsNodes.Get (0)->AggregateObject (BSPosition); bsDevs.Add (dev); if (verbose) { @@ -169,7 +169,7 @@ int main (int argc, char *argv[]) ss[i] = ssDevs.Get (i)->GetObject (); ss[i]->SetModulationType (WimaxPhy::MODULATION_TYPE_QAM16_12); - ss[i]->GetPhy ()->SetMobility (SSPosition[i]); + ssNodes.Get (i)->AggregateObject (SSPosition[i]); } diff --git a/src/devices/wimax/bs-link-manager.cc b/src/devices/wimax/bs-link-manager.cc index fcfae2bce..258a6952c 100644 --- a/src/devices/wimax/bs-link-manager.cc +++ b/src/devices/wimax/bs-link-manager.cc @@ -93,11 +93,12 @@ BSLinkManager::ProcessRangingRequest (Cid cid, RngReq rngreq) * m_bs->GetSymbolDuration ().GetSeconds ()); } - NS_ASSERT_MSG (Simulator::Now () >= m_bs->GetUlSubframeStartTime () && Simulator::Now () < irIntervalBoundary, - "Base station: Error while processing ranging request: out of time"); tries++; - PerformRanging (cid, rngreq); + if (Simulator::Now () >= m_bs->GetUlSubframeStartTime () && Simulator::Now () < irIntervalBoundary) + { + PerformRanging (cid, rngreq); + } } void diff --git a/src/devices/wimax/simple-ofdm-wimax-channel.cc b/src/devices/wimax/simple-ofdm-wimax-channel.cc index 314789740..aae4df055 100644 --- a/src/devices/wimax/simple-ofdm-wimax-channel.cc +++ b/src/devices/wimax/simple-ofdm-wimax-channel.cc @@ -145,23 +145,19 @@ SimpleOfdmWimaxChannel::Send (Time BlockTime, double rxPowerDbm = 0; Ptr senderMobility = 0; Ptr receiverMobility = 0; - if (phy->GetMobility ()) - { - senderMobility = phy->GetMobility ()->GetObject (); - } + senderMobility = phy->GetDevice ()->GetNode ()->GetObject (); for (std::list >::iterator iter = m_phyList.begin (); iter != m_phyList.end (); ++iter) { - double delay = 0; + Time delay = Seconds(0); if (phy != *iter) { - if ((*iter)->GetMobility ()) - { - receiverMobility = (*iter)->GetMobility ()->GetObject (); - } + double distance = 0; + receiverMobility = (*iter)->GetDevice ()->GetNode ()->GetObject (); if (receiverMobility != 0 && senderMobility != 0 && m_loss != 0) { - delay = (senderMobility->GetDistanceFrom (receiverMobility)) / 300000000LL; + distance = senderMobility->GetDistanceFrom (receiverMobility); + delay = Seconds(distance/300000000.0); rxPowerDbm = m_loss->CalcRxPower (rxPowerDbm, senderMobility, receiverMobility); } simpleOfdmSendParam * param = new simpleOfdmSendParam (fecBlock, @@ -183,7 +179,7 @@ SimpleOfdmWimaxChannel::Send (Time BlockTime, dstNode = dstNetDevice->GetObject ()->GetNode ()->GetId (); } Simulator::ScheduleWithContext (dstNode, - Seconds (delay) + BlockTime, + delay, &SimpleOfdmWimaxChannel::EndSend, this, *iter, @@ -196,7 +192,6 @@ SimpleOfdmWimaxChannel::Send (Time BlockTime, void SimpleOfdmWimaxChannel::EndSend (Ptr rxphy, simpleOfdmSendParam * param) { - // std::cout << "END_SEND "; rxphy->StartReceive (param->GetFecBlock (), param->GetBurstSize (), param->GetIsFirstBlock (), diff --git a/src/devices/wimax/simple-ofdm-wimax-phy.cc b/src/devices/wimax/simple-ofdm-wimax-phy.cc index 4ba774217..48329552f 100644 --- a/src/devices/wimax/simple-ofdm-wimax-phy.cc +++ b/src/devices/wimax/simple-ofdm-wimax-phy.cc @@ -311,12 +311,7 @@ SimpleOfdmWimaxPhy::EndSendFecBlock (WimaxPhy::ModulationType modulationType, } else { - Simulator::Schedule (Seconds (0), - &SimpleOfdmWimaxPhy::StartSendFecBlock, - this, - false, - modulationType, - direction); + StartSendFecBlock(false,modulationType,direction); } } @@ -392,7 +387,7 @@ SimpleOfdmWimaxPhy::StartReceive (const bvec &fecBlock, SetBlockParameters (burstSize, modulationType); m_blockTime = GetBlockTransmissionTime (modulationType); } - Simulator::Schedule (Seconds (0), + Simulator::Schedule (m_blockTime, &SimpleOfdmWimaxPhy::EndReceiveFecBlock, this, fecBlock,