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 |
| TestCase & | operator= (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... | |
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. | |
| TestCase * | GetParent () 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. | |
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.
| TcpEndPointBug2211Test::TcpEndPointBug2211Test | ( | std::string | desc, |
| bool | ipVersion ) |
Constructor.
| desc | Test description. |
| ipVersion | True to use IPv6. |
Definition at line 95 of file tcp-endpoint-bug2211.cc.
References ns3::TestCase::TestCase(), and m_v6.
Here is the call graph for this function:
|
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:Handle an incoming connection.
| s | The receiving socket. |
| from | The 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:Handle a connection establishment.
| socket | The 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:Receive a packet.
| socket | The receiving socket. |
Definition at line 72 of file tcp-endpoint-bug2211.cc.
Referenced by HandleAccept().
Here is the caller graph for this function:
|
private |
True to use IPv6.
Definition at line 68 of file tcp-endpoint-bug2211.cc.
Referenced by TcpEndPointBug2211Test(), and DoRun().