From e80b59104f575ada05950e2cd010dc1680df3f73 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 12 Dec 2018 19:25:43 -0800 Subject: tcp: fix handling of no wscale in syns Change-Id: I7219a8d315b312812acafd9d2709fba8b4a2a679 Signed-off-by: Florin Coras --- src/vnet/tcp/tcp_input.c | 2 ++ src/vnet/tcp/tcp_output.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c index 395943739e8..fc1aff40747 100644 --- a/src/vnet/tcp/tcp_input.c +++ b/src/vnet/tcp/tcp_input.c @@ -2480,6 +2480,8 @@ tcp46_syn_sent_inline (vlib_main_t * vm, vlib_node_runtime_t * node, if (tcp_opts_wscale (&new_tc0->rcv_opts)) new_tc0->snd_wscale = new_tc0->rcv_opts.wscale; + else + new_tc0->rcv_wscale = 0; new_tc0->snd_wnd = clib_net_to_host_u16 (tcp0->window) << new_tc0->snd_wscale; diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c index 7cee34995e3..113fb148c37 100644 --- a/src/vnet/tcp/tcp_output.c +++ b/src/vnet/tcp/tcp_output.c @@ -126,7 +126,10 @@ tcp_initial_window_to_advertise (tcp_connection_t * tc) * scale to be computed in the same way */ max_fifo = tm->max_rx_fifo ? tm->max_rx_fifo : TCP_MAX_RX_FIFO_SIZE; - tc->rcv_wscale = tcp_window_compute_scale (max_fifo); + /* Compute rcv wscale only if peer advertised support for it */ + if (tc->state != TCP_STATE_SYN_RCVD || tcp_opts_wscale (&tc->rcv_opts)) + tc->rcv_wscale = tcp_window_compute_scale (max_fifo); + tc->rcv_wnd = tcp_initial_wnd_unscaled (tc); return clib_min (tc->rcv_wnd, TCP_WND_MAX); -- cgit 1.2.3-korg