Commit c6214a97 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David S. Miller

ipv4: Namespaceify tcp_retries2 sysctl knob

Signed-off-by: default avatarNikolay Borisov <kernel@kyup.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ae5c3f40
...@@ -103,6 +103,7 @@ struct netns_ipv4 { ...@@ -103,6 +103,7 @@ struct netns_ipv4 {
int sysctl_tcp_syncookies; int sysctl_tcp_syncookies;
int sysctl_tcp_reordering; int sysctl_tcp_reordering;
int sysctl_tcp_retries1; int sysctl_tcp_retries1;
int sysctl_tcp_retries2;
struct ping_group_range ping_group_range; struct ping_group_range ping_group_range;
......
...@@ -240,7 +240,6 @@ extern int sysctl_tcp_timestamps; ...@@ -240,7 +240,6 @@ extern int sysctl_tcp_timestamps;
extern int sysctl_tcp_window_scaling; extern int sysctl_tcp_window_scaling;
extern int sysctl_tcp_sack; extern int sysctl_tcp_sack;
extern int sysctl_tcp_fin_timeout; extern int sysctl_tcp_fin_timeout;
extern int sysctl_tcp_retries2;
extern int sysctl_tcp_orphan_retries; extern int sysctl_tcp_orphan_retries;
extern int sysctl_tcp_fastopen; extern int sysctl_tcp_fastopen;
extern int sysctl_tcp_retrans_collapse; extern int sysctl_tcp_retrans_collapse;
......
...@@ -319,13 +319,6 @@ static struct ctl_table ipv4_table[] = { ...@@ -319,13 +319,6 @@ static struct ctl_table ipv4_table[] = {
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dointvec
}, },
{
.procname = "tcp_retries2",
.data = &sysctl_tcp_retries2,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec
},
{ {
.procname = "tcp_fin_timeout", .procname = "tcp_fin_timeout",
.data = &sysctl_tcp_fin_timeout, .data = &sysctl_tcp_fin_timeout,
...@@ -960,6 +953,13 @@ static struct ctl_table ipv4_net_table[] = { ...@@ -960,6 +953,13 @@ static struct ctl_table ipv4_net_table[] = {
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dointvec_minmax,
.extra2 = &tcp_retr1_max .extra2 = &tcp_retr1_max
}, },
{
.procname = "tcp_retries2",
.data = &init_net.ipv4.sysctl_tcp_retries2,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec
},
{ } { }
}; };
......
...@@ -2392,6 +2392,7 @@ static int __net_init tcp_sk_init(struct net *net) ...@@ -2392,6 +2392,7 @@ static int __net_init tcp_sk_init(struct net *net)
net->ipv4.sysctl_tcp_syncookies = 0; net->ipv4.sysctl_tcp_syncookies = 0;
net->ipv4.sysctl_tcp_reordering = TCP_FASTRETRANS_THRESH; net->ipv4.sysctl_tcp_reordering = TCP_FASTRETRANS_THRESH;
net->ipv4.sysctl_tcp_retries1 = TCP_RETR1; net->ipv4.sysctl_tcp_retries1 = TCP_RETR1;
net->ipv4.sysctl_tcp_retries2 = TCP_RETR2;
return 0; return 0;
fail: fail:
......
...@@ -3476,6 +3476,7 @@ void tcp_send_probe0(struct sock *sk) ...@@ -3476,6 +3476,7 @@ void tcp_send_probe0(struct sock *sk)
{ {
struct inet_connection_sock *icsk = inet_csk(sk); struct inet_connection_sock *icsk = inet_csk(sk);
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
struct net *net = sock_net(sk);
unsigned long probe_max; unsigned long probe_max;
int err; int err;
...@@ -3489,7 +3490,7 @@ void tcp_send_probe0(struct sock *sk) ...@@ -3489,7 +3490,7 @@ void tcp_send_probe0(struct sock *sk)
} }
if (err <= 0) { if (err <= 0) {
if (icsk->icsk_backoff < sysctl_tcp_retries2) if (icsk->icsk_backoff < net->ipv4.sysctl_tcp_retries2)
icsk->icsk_backoff++; icsk->icsk_backoff++;
icsk->icsk_probes_out++; icsk->icsk_probes_out++;
probe_max = TCP_RTO_MAX; probe_max = TCP_RTO_MAX;
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <linux/gfp.h> #include <linux/gfp.h>
#include <net/tcp.h> #include <net/tcp.h>
int sysctl_tcp_retries2 __read_mostly = TCP_RETR2;
int sysctl_tcp_orphan_retries __read_mostly; int sysctl_tcp_orphan_retries __read_mostly;
int sysctl_tcp_thin_linear_timeouts __read_mostly; int sysctl_tcp_thin_linear_timeouts __read_mostly;
...@@ -189,7 +188,7 @@ static int tcp_write_timeout(struct sock *sk) ...@@ -189,7 +188,7 @@ static int tcp_write_timeout(struct sock *sk)
dst_negative_advice(sk); dst_negative_advice(sk);
} }
retry_until = sysctl_tcp_retries2; retry_until = net->ipv4.sysctl_tcp_retries2;
if (sock_flag(sk, SOCK_DEAD)) { if (sock_flag(sk, SOCK_DEAD)) {
const bool alive = icsk->icsk_rto < TCP_RTO_MAX; const bool alive = icsk->icsk_rto < TCP_RTO_MAX;
...@@ -303,7 +302,7 @@ static void tcp_probe_timer(struct sock *sk) ...@@ -303,7 +302,7 @@ static void tcp_probe_timer(struct sock *sk)
(s32)(tcp_time_stamp - start_ts) > icsk->icsk_user_timeout) (s32)(tcp_time_stamp - start_ts) > icsk->icsk_user_timeout)
goto abort; goto abort;
max_probes = sysctl_tcp_retries2; max_probes = sock_net(sk)->ipv4.sysctl_tcp_retries2;
if (sock_flag(sk, SOCK_DEAD)) { if (sock_flag(sk, SOCK_DEAD)) {
const bool alive = inet_csk_rto_backoff(icsk, TCP_RTO_MAX) < TCP_RTO_MAX; const bool alive = inet_csk_rto_backoff(icsk, TCP_RTO_MAX) < TCP_RTO_MAX;
......
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