Commit 9bb37ef0 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

tcp: Namespaceify sysctl_tcp_window_scaling

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f9301034
...@@ -123,6 +123,7 @@ struct netns_ipv4 { ...@@ -123,6 +123,7 @@ struct netns_ipv4 {
unsigned int sysctl_tcp_notsent_lowat; unsigned int sysctl_tcp_notsent_lowat;
int sysctl_tcp_tw_reuse; int sysctl_tcp_tw_reuse;
int sysctl_tcp_sack; int sysctl_tcp_sack;
int sysctl_tcp_window_scaling;
struct inet_timewait_death_row tcp_death_row; struct inet_timewait_death_row tcp_death_row;
int sysctl_max_syn_backlog; int sysctl_max_syn_backlog;
......
...@@ -238,7 +238,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo); ...@@ -238,7 +238,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
/* sysctl variables for tcp */ /* sysctl variables for tcp */
extern int sysctl_tcp_timestamps; extern int sysctl_tcp_timestamps;
extern int sysctl_tcp_window_scaling;
extern int sysctl_tcp_fastopen; extern int sysctl_tcp_fastopen;
extern int sysctl_tcp_retrans_collapse; extern int sysctl_tcp_retrans_collapse;
extern int sysctl_tcp_stdurg; extern int sysctl_tcp_stdurg;
......
...@@ -257,7 +257,7 @@ bool cookie_timestamp_decode(const struct net *net, ...@@ -257,7 +257,7 @@ bool cookie_timestamp_decode(const struct net *net,
tcp_opt->wscale_ok = 1; tcp_opt->wscale_ok = 1;
tcp_opt->snd_wscale = options & TS_OPT_WSCALE_MASK; tcp_opt->snd_wscale = options & TS_OPT_WSCALE_MASK;
return sysctl_tcp_window_scaling != 0; return net->ipv4.sysctl_tcp_window_scaling != 0;
} }
EXPORT_SYMBOL(cookie_timestamp_decode); EXPORT_SYMBOL(cookie_timestamp_decode);
......
...@@ -371,13 +371,6 @@ static struct ctl_table ipv4_table[] = { ...@@ -371,13 +371,6 @@ static struct ctl_table ipv4_table[] = {
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dointvec
}, },
{
.procname = "tcp_window_scaling",
.data = &sysctl_tcp_window_scaling,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec
},
{ {
.procname = "tcp_retrans_collapse", .procname = "tcp_retrans_collapse",
.data = &sysctl_tcp_retrans_collapse, .data = &sysctl_tcp_retrans_collapse,
...@@ -1116,6 +1109,13 @@ static struct ctl_table ipv4_net_table[] = { ...@@ -1116,6 +1109,13 @@ static struct ctl_table ipv4_net_table[] = {
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dointvec
}, },
{
.procname = "tcp_window_scaling",
.data = &init_net.ipv4.sysctl_tcp_window_scaling,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec
},
{ } { }
}; };
......
...@@ -77,7 +77,6 @@ ...@@ -77,7 +77,6 @@
#include <linux/errqueue.h> #include <linux/errqueue.h>
int sysctl_tcp_timestamps __read_mostly = 1; int sysctl_tcp_timestamps __read_mostly = 1;
int sysctl_tcp_window_scaling __read_mostly = 1;
int sysctl_tcp_fack __read_mostly; int sysctl_tcp_fack __read_mostly;
int sysctl_tcp_max_reordering __read_mostly = 300; int sysctl_tcp_max_reordering __read_mostly = 300;
int sysctl_tcp_dsack __read_mostly = 1; int sysctl_tcp_dsack __read_mostly = 1;
...@@ -3765,7 +3764,7 @@ void tcp_parse_options(const struct net *net, ...@@ -3765,7 +3764,7 @@ void tcp_parse_options(const struct net *net,
break; break;
case TCPOPT_WINDOW: case TCPOPT_WINDOW:
if (opsize == TCPOLEN_WINDOW && th->syn && if (opsize == TCPOLEN_WINDOW && th->syn &&
!estab && sysctl_tcp_window_scaling) { !estab && net->ipv4.sysctl_tcp_window_scaling) {
__u8 snd_wscale = *(__u8 *)ptr; __u8 snd_wscale = *(__u8 *)ptr;
opt_rx->wscale_ok = 1; opt_rx->wscale_ok = 1;
if (snd_wscale > TCP_MAX_WSCALE) { if (snd_wscale > TCP_MAX_WSCALE) {
......
...@@ -2466,6 +2466,7 @@ static int __net_init tcp_sk_init(struct net *net) ...@@ -2466,6 +2466,7 @@ static int __net_init tcp_sk_init(struct net *net)
net->ipv4.sysctl_max_syn_backlog = max(128, cnt / 256); net->ipv4.sysctl_max_syn_backlog = max(128, cnt / 256);
net->ipv4.sysctl_tcp_sack = 1; net->ipv4.sysctl_tcp_sack = 1;
net->ipv4.sysctl_tcp_window_scaling = 1;
return 0; return 0;
fail: fail:
......
...@@ -575,7 +575,7 @@ static unsigned int tcp_syn_options(struct sock *sk, struct sk_buff *skb, ...@@ -575,7 +575,7 @@ static unsigned int tcp_syn_options(struct sock *sk, struct sk_buff *skb,
opts->tsecr = tp->rx_opt.ts_recent; opts->tsecr = tp->rx_opt.ts_recent;
remaining -= TCPOLEN_TSTAMP_ALIGNED; remaining -= TCPOLEN_TSTAMP_ALIGNED;
} }
if (likely(sysctl_tcp_window_scaling)) { if (likely(sock_net(sk)->ipv4.sysctl_tcp_window_scaling)) {
opts->ws = tp->rx_opt.rcv_wscale; opts->ws = tp->rx_opt.rcv_wscale;
opts->options |= OPTION_WSCALE; opts->options |= OPTION_WSCALE;
remaining -= TCPOLEN_WSCALE_ALIGNED; remaining -= TCPOLEN_WSCALE_ALIGNED;
...@@ -3303,7 +3303,7 @@ static void tcp_connect_init(struct sock *sk) ...@@ -3303,7 +3303,7 @@ static void tcp_connect_init(struct sock *sk)
tp->advmss - (tp->rx_opt.ts_recent_stamp ? tp->tcp_header_len - sizeof(struct tcphdr) : 0), tp->advmss - (tp->rx_opt.ts_recent_stamp ? tp->tcp_header_len - sizeof(struct tcphdr) : 0),
&tp->rcv_wnd, &tp->rcv_wnd,
&tp->window_clamp, &tp->window_clamp,
sysctl_tcp_window_scaling, sock_net(sk)->ipv4.sysctl_tcp_window_scaling,
&rcv_wscale, &rcv_wscale,
dst_metric(dst, RTAX_INITRWND)); dst_metric(dst, RTAX_INITRWND));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment