From cf6c3437109637166b069b56b7be45094ea9f234 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 11 Oct 2017 11:30:38 -0700 Subject: tcp: update thread time when initializing connection (VPP-1022) Change-Id: I92b0dbd2d795e3ba9050797ede2b08638e55b6f5 Signed-off-by: Florin Coras --- src/vnet/tcp/tcp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; -- cgit 1.2.3-korg