aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-05-08 16:23:38 +0000
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-18 09:54:56 +0000
commita316c17d9ec3d859eea86368ed465d96ac44701b (patch)
tree82ad062041c0c53ecbc6368336562422c0669dd1
parentf812f51873f7b7ae458ae6af6eb23616a4013121 (diff)
tcp: avoid rcv wnd less than mss
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I84ec1c91a3a7b2195aad58923fa6f17f551444cb (cherry picked from commit f2fe353cc829f2074d63ebba9bb3b25e5ceb20af)
-rw-r--r--src/vnet/tcp/tcp_output.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 9eba05eb71e..464cf5255eb 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -144,13 +144,11 @@ tcp_update_rcv_wnd (tcp_connection_t * tc)
wnd = available_space;
}
- /* Make sure we have a multiple of rcv_wscale */
+ /* Make sure we have a multiple of 1 << rcv_wscale. We round up to
+ * avoid advertising a window less than mss which could happen if
+ * 1 << rcv_wscale < mss */
if (wnd && tc->rcv_wscale)
- {
- wnd &= ~((1 << tc->rcv_wscale) - 1);
- if (wnd == 0)
- wnd = 1 << tc->rcv_wscale;
- }
+ wnd = round_pow2 (wnd, 1 << tc->rcv_wscale);
tc->rcv_wnd = clib_min (wnd, TCP_WND_MAX << tc->rcv_wscale);
}