tcp: account for option alignment in initial snd_mss 53/31553/3
authorFlorin Coras <fcoras@cisco.com>
Fri, 5 Mar 2021 21:30:18 +0000 (13:30 -0800)
committerDave Barach <openvpp@barachs.net>
Mon, 8 Mar 2021 15:26:28 +0000 (15:26 +0000)
Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I24225ada6623c5b5543341ecac0d6c1db43cc8a9

src/vnet/tcp/tcp.c

index 407ba95..161b8ef 100644 (file)
@@ -657,9 +657,10 @@ tcp_init_mss (tcp_connection_t * tc)
   /* We should have enough space for 40 bytes of options */
   ASSERT (tc->snd_mss > 45);
 
-  /* If we use timestamp option, account for it */
+  /* If we use timestamp option, account for it and make sure
+   * the options are 4-byte aligned */
   if (tcp_opts_tstamp (&tc->rcv_opts))
-    tc->snd_mss -= TCP_OPTION_LEN_TIMESTAMP;
+    tc->snd_mss -= TCP_OPTION_LEN_TIMESTAMP + 2 /* alignment */;
 }
 
 /**