A Discrete-Event Network Simulator
API
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. More...
 
void DoRun () override
 Implementation to actually run this TestCase. More...
 
void HandleAccept (Ptr< Socket > s, const Address &from)
 Handle an incoming connection. More...
 
void HandleConnect (Ptr< Socket > socket)
 Handle a connection establishment. More...
 
void Recv (Ptr< Socket > socket)
 Receive a packet. More...
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor. More...
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Attributes

bool m_v6
 True to use IPv6. More...
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum  TestDuration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor. More...
 
void AddTestCase (TestCase *testCase, TestDuration duration=QUICK)
 Add an individual child TestCase to this test suite. More...
 
TestCaseGetParent () const
 Get the parent of this TestCase. More...
 
bool IsStatusFailure () const
 Check if any tests failed. More...
 
bool IsStatusSuccess () const
 Check if all tests passed. More...
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found. More...
 
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. More...
 
bool MustAssertOnFailure () const
 Check if this run should assert on failure. More...
 
bool MustContinueOnFailure () const
 Check if this run should continue on failure. More...
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory. More...
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory. More...
 

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 50 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 106 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 113 of file tcp-endpoint-bug2211.cc.

References ns3::Socket::Bind(), ns3::Socket::Connect(), HandleAccept(), HandleConnect(), nsclick-simple-lan::internet, m_v6, ns3::MakeCallback(), ns3::MakeNullCallback(), ns3::Socket::SetConnectCallback(), 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 92 of file tcp-endpoint-bug2211.cc.

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

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 98 of file tcp-endpoint-bug2211.cc.

References ns3::Socket::Close(), and ns3::Socket::Send().

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 83 of file tcp-endpoint-bug2211.cc.

References ns3::Socket::Close(), and ns3::Socket::GetRxAvailable().

Referenced by HandleAccept().

+ Here is the call graph for this function:
+ 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 79 of file tcp-endpoint-bug2211.cc.

Referenced by TcpEndPointBug2211Test(), and DoRun().


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