diff --git a/src/internet/test/tcp-ecn-test.cc b/src/internet/test/tcp-ecn-test.cc index 0f1a1c10c..2ffed30b0 100644 --- a/src/internet/test/tcp-ecn-test.cc +++ b/src/internet/test/tcp-ecn-test.cc @@ -493,8 +493,12 @@ TcpEcnTest::Tx (const Ptr p, const TcpHeader &h, SocketWho who) if (m_senderSent == 3) { SocketIpTosTag ipTosTag; - p->PeekPacketTag (ipTosTag); - uint16_t ipTos = static_cast (ipTosTag.GetTos ()); + bool found = p->PeekPacketTag (ipTosTag); + uint16_t ipTos = 0; + if (found) + { + ipTos = static_cast (ipTosTag.GetTos ()); + } if (m_testcase == 4 || m_testcase == 6) { NS_TEST_ASSERT_MSG_EQ (ipTos, 0x2, "IP TOS should have ECT set if ECN negotiation between endpoints is successful");