From 7a588fc7819153fe32e7d12733da4ecd2e663437 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Fri, 5 Mar 2021 13:30:18 -0800 Subject: [PATCH] tcp: account for option alignment in initial snd_mss Type: fix Signed-off-by: Florin Coras Change-Id: I24225ada6623c5b5543341ecac0d6c1db43cc8a9 --- src/vnet/tcp/tcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index 407ba9576a8..161b8ef25a2 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -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 */; } /** -- 2.16.6