Skip to content

Commit 9bb37ef

Browse files
edumazetdavem330
authored andcommitted
tcp: Namespaceify sysctl_tcp_window_scaling
Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f930103 commit 9bb37ef

7 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎include/net/netns/ipv4.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ struct netns_ipv4 {
123123
unsigned int sysctl_tcp_notsent_lowat;
124124
int sysctl_tcp_tw_reuse;
125125
int sysctl_tcp_sack;
126+
int sysctl_tcp_window_scaling;
126127
struct inet_timewait_death_row tcp_death_row;
127128
int sysctl_max_syn_backlog;
128129

‎include/net/tcp.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
238238

239239
/* sysctl variables for tcp */
240240
extern int sysctl_tcp_timestamps;
241-
extern int sysctl_tcp_window_scaling;
242241
extern int sysctl_tcp_fastopen;
243242
extern int sysctl_tcp_retrans_collapse;
244243
extern int sysctl_tcp_stdurg;

‎net/ipv4/syncookies.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ bool cookie_timestamp_decode(const struct net *net,
257257
tcp_opt->wscale_ok = 1;
258258
tcp_opt->snd_wscale = options & TS_OPT_WSCALE_MASK;
259259

260-
return sysctl_tcp_window_scaling != 0;
260+
return net->ipv4.sysctl_tcp_window_scaling != 0;
261261
}
262262
EXPORT_SYMBOL(cookie_timestamp_decode);
263263

‎net/ipv4/sysctl_net_ipv4.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,6 @@ static struct ctl_table ipv4_table[] = {
371371
.mode = 0644,
372372
.proc_handler = proc_dointvec
373373
},
374-
{
375-
.procname = "tcp_window_scaling",
376-
.data = &sysctl_tcp_window_scaling,
377-
.maxlen = sizeof(int),
378-
.mode = 0644,
379-
.proc_handler = proc_dointvec
380-
},
381374
{
382375
.procname = "tcp_retrans_collapse",
383376
.data = &sysctl_tcp_retrans_collapse,
@@ -1116,6 +1109,13 @@ static struct ctl_table ipv4_net_table[] = {
11161109
.mode = 0644,
11171110
.proc_handler = proc_dointvec
11181111
},
1112+
{
1113+
.procname = "tcp_window_scaling",
1114+
.data = &init_net.ipv4.sysctl_tcp_window_scaling,
1115+
.maxlen = sizeof(int),
1116+
.mode = 0644,
1117+
.proc_handler = proc_dointvec
1118+
},
11191119
{ }
11201120
};
11211121

‎net/ipv4/tcp_input.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
#include <linux/errqueue.h>
7878

7979
int sysctl_tcp_timestamps __read_mostly = 1;
80-
int sysctl_tcp_window_scaling __read_mostly = 1;
8180
int sysctl_tcp_fack __read_mostly;
8281
int sysctl_tcp_max_reordering __read_mostly = 300;
8382
int sysctl_tcp_dsack __read_mostly = 1;
@@ -3765,7 +3764,7 @@ void tcp_parse_options(const struct net *net,
37653764
break;
37663765
case TCPOPT_WINDOW:
37673766
if (opsize == TCPOLEN_WINDOW && th->syn &&
3768-
!estab && sysctl_tcp_window_scaling) {
3767+
!estab && net->ipv4.sysctl_tcp_window_scaling) {
37693768
__u8 snd_wscale = *(__u8 *)ptr;
37703769
opt_rx->wscale_ok = 1;
37713770
if (snd_wscale > TCP_MAX_WSCALE) {

‎net/ipv4/tcp_ipv4.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2466,6 +2466,7 @@ static int __net_init tcp_sk_init(struct net *net)
24662466

24672467
net->ipv4.sysctl_max_syn_backlog = max(128, cnt / 256);
24682468
net->ipv4.sysctl_tcp_sack = 1;
2469+
net->ipv4.sysctl_tcp_window_scaling = 1;
24692470

24702471
return 0;
24712472
fail:

‎net/ipv4/tcp_output.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ static unsigned int tcp_syn_options(struct sock *sk, struct sk_buff *skb,
575575
opts->tsecr = tp->rx_opt.ts_recent;
576576
remaining -= TCPOLEN_TSTAMP_ALIGNED;
577577
}
578-
if (likely(sysctl_tcp_window_scaling)) {
578+
if (likely(sock_net(sk)->ipv4.sysctl_tcp_window_scaling)) {
579579
opts->ws = tp->rx_opt.rcv_wscale;
580580
opts->options |= OPTION_WSCALE;
581581
remaining -= TCPOLEN_WSCALE_ALIGNED;
@@ -3303,7 +3303,7 @@ static void tcp_connect_init(struct sock *sk)
33033303
tp->advmss - (tp->rx_opt.ts_recent_stamp ? tp->tcp_header_len - sizeof(struct tcphdr) : 0),
33043304
&tp->rcv_wnd,
33053305
&tp->window_clamp,
3306-
sysctl_tcp_window_scaling,
3306+
sock_net(sk)->ipv4.sysctl_tcp_window_scaling,
33073307
&rcv_wscale,
33083308
dst_metric(dst, RTAX_INITRWND));
33093309

0 commit comments

Comments
 (0)