tcp: update thread time when initializing connection (VPP-1022) 63/8763/1 v17.10-rc2
authorFlorin Coras <fcoras@cisco.com>
Wed, 11 Oct 2017 18:30:38 +0000 (11:30 -0700)
committerFlorin Coras <fcoras@cisco.com>
Wed, 11 Oct 2017 18:30:38 +0000 (11:30 -0700)
Change-Id: I92b0dbd2d795e3ba9050797ede2b08638e55b6f5
Signed-off-by: Florin Coras <fcoras@cisco.com>
src/vnet/tcp/tcp.c

index 2f62345..a365cb4 100644 (file)
@@ -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;