diff options
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r-- | net/ipv4/tcp_output.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index de3bd8458588..01b94b8d9ec9 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -2429,6 +2429,12 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
2429 | __u8 rcv_wscale; | 2429 | __u8 rcv_wscale; |
2430 | /* Set this up on the first call only */ | 2430 | /* Set this up on the first call only */ |
2431 | req->window_clamp = tp->window_clamp ? : dst_metric(dst, RTAX_WINDOW); | 2431 | req->window_clamp = tp->window_clamp ? : dst_metric(dst, RTAX_WINDOW); |
2432 | |||
2433 | /* limit the window selection if the user enforce a smaller rx buffer */ | ||
2434 | if (sk->sk_userlocks & SOCK_RCVBUF_LOCK && | ||
2435 | (req->window_clamp > tcp_full_space(sk) || req->window_clamp == 0)) | ||
2436 | req->window_clamp = tcp_full_space(sk); | ||
2437 | |||
2432 | /* tcp_full_space because it is guaranteed to be the first packet */ | 2438 | /* tcp_full_space because it is guaranteed to be the first packet */ |
2433 | tcp_select_initial_window(tcp_full_space(sk), | 2439 | tcp_select_initial_window(tcp_full_space(sk), |
2434 | mss - (ireq->tstamp_ok ? TCPOLEN_TSTAMP_ALIGNED : 0), | 2440 | mss - (ireq->tstamp_ok ? TCPOLEN_TSTAMP_ALIGNED : 0), |
@@ -2555,6 +2561,11 @@ static void tcp_connect_init(struct sock *sk) | |||
2555 | 2561 | ||
2556 | tcp_initialize_rcv_mss(sk); | 2562 | tcp_initialize_rcv_mss(sk); |
2557 | 2563 | ||
2564 | /* limit the window selection if the user enforce a smaller rx buffer */ | ||
2565 | if (sk->sk_userlocks & SOCK_RCVBUF_LOCK && | ||
2566 | (tp->window_clamp > tcp_full_space(sk) || tp->window_clamp == 0)) | ||
2567 | tp->window_clamp = tcp_full_space(sk); | ||
2568 | |||
2558 | tcp_select_initial_window(tcp_full_space(sk), | 2569 | tcp_select_initial_window(tcp_full_space(sk), |
2559 | tp->advmss - (tp->rx_opt.ts_recent_stamp ? tp->tcp_header_len - sizeof(struct tcphdr) : 0), | 2570 | tp->advmss - (tp->rx_opt.ts_recent_stamp ? tp->tcp_header_len - sizeof(struct tcphdr) : 0), |
2560 | &tp->rcv_wnd, | 2571 | &tp->rcv_wnd, |