From d51ef3cac46833be2ecaaf97a2dcc5d3c49e5813 Mon Sep 17 00:00:00 2001 From: Natale Patriciello Date: Wed, 13 Dec 2017 19:05:02 +0100 Subject: [PATCH] tcp: (fixes #2653) to not save smaller ts --- RELEASE_NOTES | 1 + src/internet/model/tcp-socket-base.cc | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index c24a2bc6e..49956209f 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -32,6 +32,7 @@ New user-visible features Bugs fixed ---------- - Bug 2505 - network: Avoid asserts in Header/Trailer deserialization +- Bug 2653 - tcp: Avoid saving smaller TS in case of packet reordering - Bug 2764 - wifi: WifiSpectrumModelId doesn't distinguish 11ax from legacy - Bug 2766 - core: Modify logging for int64x64 to avoid stack overflow - Bug 2824 - ICMP opcode fr fragment timeout drop is wrong diff --git a/src/internet/model/tcp-socket-base.cc b/src/internet/model/tcp-socket-base.cc index 49a6ba837..536f16b8e 100644 --- a/src/internet/model/tcp-socket-base.cc +++ b/src/internet/model/tcp-socket-base.cc @@ -3845,6 +3845,14 @@ TcpSocketBase::ProcessOptionTimestamp (const Ptr option, Ptr ts = DynamicCast (option); + // This is valid only when no overflow occours. It happens + // when a connection last longer than 50 days. + if (m_tcb->m_rcvTimestampValue > ts->GetTimestamp ()) + { + // Do not save a smaller timestamp (probably there is reordering) + return; + } + m_tcb->m_rcvTimestampValue = ts->GetTimestamp (); m_tcb->m_rcvTimestampEchoReply = ts->GetEcho ();