A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
TcpEndPointBug2211Test Class Reference

Test for bug 2211. More...

+ Inheritance diagram for TcpEndPointBug2211Test:
+ Collaboration diagram for TcpEndPointBug2211Test:

Public Member Functions

 TcpEndPointBug2211Test (std::string desc, bool ipVersion)
 Constructor.
 
void DoRun () override
 Implementation to actually run this TestCase.
 
void HandleAccept (Ptr< Socket > s, const Address &from)
 Handle an incoming connection.
 
void HandleConnect (Ptr< Socket > socket)
 Handle a connection establishment.
 
void Recv (Ptr< Socket > socket)
 Receive a packet.
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Attributes

bool m_v6
 True to use IPv6.
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum class  Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 
- Static Public Attributes inherited from ns3::TestCase
static constexpr auto QUICK = Duration::QUICK
 Deprecated test duration simple enums.
 
static constexpr auto EXTENSIVE = Duration::EXTENSIVE
 
static constexpr auto TAKES_FOREVER = Duration::TAKES_FOREVER
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor.
 
void AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK)
 Add an individual child TestCase to this test suite.
 
TestCaseGetParent () const
 Get the parent of this TestCase.
 
bool IsStatusFailure () const
 Check if any tests failed.
 
bool IsStatusSuccess () const
 Check if all tests passed.
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found.
 
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
 Log the failure of this TestCase.
 
bool MustAssertOnFailure () const
 Check if this run should assert on failure.
 
bool MustContinueOnFailure () const
 Check if this run should continue on failure.
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory.
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory.
 

Detailed Description

Test for bug 2211.

https://www.nsnam.org/bugzilla/show_bug.cgi?id=2211

NOTE: It is a valgrind testcase, it contains no ASSERTs.

Test creates one node and sets up two TCP sockets on the loopback with default parameters: CWND = 1, MTU = 536. Sender socket sends 3 segments. When first segment is acknowledged, cwnd is raised to 2. Then, two segments are sent and arrive into receive buffer. Until bugfix, the following happened: Ipv4EndPoint::ForwardUp was called for both second and third segment. These calls scheduled two Ipv4EndPoint::DoForwardUp events. To demonstrate the bug, test case closes the receiver socket after receiving the second segment. As a result, Ipv4EndPoint is destroyed. However, Ipv4EndPoint::DoForwardUp is already scheduled for third segment. It is a use-after-free bug.

Definition at line 39 of file tcp-endpoint-bug2211.cc.

Constructor & Destructor Documentation

◆ TcpEndPointBug2211Test()

TcpEndPointBug2211Test::TcpEndPointBug2211Test ( std::string desc,
bool ipVersion )

Constructor.

Parameters
descTest description.
ipVersionTrue to use IPv6.

Definition at line 95 of file tcp-endpoint-bug2211.cc.

References m_v6.

Member Function Documentation

◆ DoRun()

void TcpEndPointBug2211Test::DoRun ( )
overridevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 102 of file tcp-endpoint-bug2211.cc.

References ns3::CreateObject(), ns3::Socket::CreateSocket(), ns3::Simulator::Destroy(), ns3::Ipv4Address::GetAny(), ns3::Ipv6Address::GetAny(), ns3::Ipv4Address::GetLoopback(), ns3::Ipv6Address::GetLoopback(), ns3::TcpSocketFactory::GetTypeId(), HandleAccept(), HandleConnect(), m_v6, ns3::MakeCallback(), ns3::MakeNullCallback(), ns3::Simulator::Run(), and sink.

+ Here is the call graph for this function:

◆ HandleAccept()

void TcpEndPointBug2211Test::HandleAccept ( Ptr< Socket > s,
const Address & from )

Handle an incoming connection.

Parameters
sThe receiving socket.
fromThe other node IP address.

Definition at line 81 of file tcp-endpoint-bug2211.cc.

References ns3::MakeCallback(), and Recv().

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleConnect()

void TcpEndPointBug2211Test::HandleConnect ( Ptr< Socket > socket)

Handle a connection establishment.

Parameters
socketThe receiving socket.

Definition at line 87 of file tcp-endpoint-bug2211.cc.

References ns3::Create().

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Recv()

void TcpEndPointBug2211Test::Recv ( Ptr< Socket > socket)

Receive a packet.

Parameters
socketThe receiving socket.

Definition at line 72 of file tcp-endpoint-bug2211.cc.

Referenced by HandleAccept().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_v6

bool TcpEndPointBug2211Test::m_v6
private

True to use IPv6.

Definition at line 68 of file tcp-endpoint-bug2211.cc.

Referenced by TcpEndPointBug2211Test(), and DoRun().


The documentation for this class was generated from the following file: