summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2017-10-11 11:30:38 -0700
committerFlorin Coras <fcoras@cisco.com>2017-10-11 11:30:38 -0700
commitcf6c3437109637166b069b56b7be45094ea9f234 (patch)
treed89a0384ab8c94ffa5efab54765d9b68ae64eb38
parente0c078aa2a2f4afcb36a27cda41171facf66256e (diff)
tcp: update thread time when initializing connection (VPP-1022)v17.10-rc2
Change-Id: I92b0dbd2d795e3ba9050797ede2b08638e55b6f5 Signed-off-by: Florin Coras <fcoras@cisco.com>
-rw-r--r--src/vnet/tcp/tcp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c
index 2f6234562e2..a365cb48f94 100644
--- a/src/vnet/tcp/tcp.c
+++ b/src/vnet/tcp/tcp.c
@@ -570,8 +570,15 @@ tcp_init_snd_vars (tcp_connection_t * tc)
{
u32 time_now;
- /* Set random initial sequence */
+ /*
+ * We use the time to randomize iss and for setting up the initial
+ * timestamp. Make sure it's updated otherwise syn and ack in the
+ * handshake may make it look as if time has flown in the opposite
+ * direction for us.
+ */
+ tcp_set_time_now (vlib_get_thread_index ());
time_now = tcp_time_now ();
+
tc->iss = random_u32 (&time_now);
tc->snd_una = tc->iss;
tc->snd_nxt = tc->iss + 1;