ipv4: Namespaceify tcp synack retries sysctl knob
Signed-off-by: Nikolay Borisov <kernel@kyup.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
6fa2516630
Коммит
7c083ecb3b
|
@ -99,6 +99,7 @@ struct netns_ipv4 {
|
||||||
int sysctl_tcp_keepalive_intvl;
|
int sysctl_tcp_keepalive_intvl;
|
||||||
|
|
||||||
int sysctl_tcp_syn_retries;
|
int sysctl_tcp_syn_retries;
|
||||||
|
int sysctl_tcp_synack_retries;
|
||||||
|
|
||||||
struct ping_group_range ping_group_range;
|
struct ping_group_range ping_group_range;
|
||||||
|
|
||||||
|
|
|
@ -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_synack_retries;
|
|
||||||
extern int sysctl_tcp_retries1;
|
extern int sysctl_tcp_retries1;
|
||||||
extern int sysctl_tcp_retries2;
|
extern int sysctl_tcp_retries2;
|
||||||
extern int sysctl_tcp_orphan_retries;
|
extern int sysctl_tcp_orphan_retries;
|
||||||
|
|
|
@ -482,10 +482,6 @@ EXPORT_SYMBOL_GPL(inet_csk_route_child_sock);
|
||||||
#define AF_INET_FAMILY(fam) true
|
#define AF_INET_FAMILY(fam) true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Only thing we need from tcp.h */
|
|
||||||
extern int sysctl_tcp_synack_retries;
|
|
||||||
|
|
||||||
|
|
||||||
/* Decide when to expire the request and when to resend SYN-ACK */
|
/* Decide when to expire the request and when to resend SYN-ACK */
|
||||||
static inline void syn_ack_recalc(struct request_sock *req, const int thresh,
|
static inline void syn_ack_recalc(struct request_sock *req, const int thresh,
|
||||||
const int max_retries,
|
const int max_retries,
|
||||||
|
@ -557,6 +553,7 @@ static void reqsk_timer_handler(unsigned long data)
|
||||||
{
|
{
|
||||||
struct request_sock *req = (struct request_sock *)data;
|
struct request_sock *req = (struct request_sock *)data;
|
||||||
struct sock *sk_listener = req->rsk_listener;
|
struct sock *sk_listener = req->rsk_listener;
|
||||||
|
struct net *net = sock_net(sk_listener);
|
||||||
struct inet_connection_sock *icsk = inet_csk(sk_listener);
|
struct inet_connection_sock *icsk = inet_csk(sk_listener);
|
||||||
struct request_sock_queue *queue = &icsk->icsk_accept_queue;
|
struct request_sock_queue *queue = &icsk->icsk_accept_queue;
|
||||||
int qlen, expire = 0, resend = 0;
|
int qlen, expire = 0, resend = 0;
|
||||||
|
@ -566,7 +563,7 @@ static void reqsk_timer_handler(unsigned long data)
|
||||||
if (sk_state_load(sk_listener) != TCP_LISTEN)
|
if (sk_state_load(sk_listener) != TCP_LISTEN)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
max_retries = icsk->icsk_syn_retries ? : sysctl_tcp_synack_retries;
|
max_retries = icsk->icsk_syn_retries ? : net->ipv4.sysctl_tcp_synack_retries;
|
||||||
thresh = max_retries;
|
thresh = max_retries;
|
||||||
/* Normally all the openreqs are young and become mature
|
/* Normally all the openreqs are young and become mature
|
||||||
* (i.e. converted to established socket) for first timeout.
|
* (i.e. converted to established socket) for first timeout.
|
||||||
|
|
|
@ -291,13 +291,6 @@ static struct ctl_table ipv4_table[] = {
|
||||||
.extra1 = &ip_ttl_min,
|
.extra1 = &ip_ttl_min,
|
||||||
.extra2 = &ip_ttl_max,
|
.extra2 = &ip_ttl_max,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.procname = "tcp_synack_retries",
|
|
||||||
.data = &sysctl_tcp_synack_retries,
|
|
||||||
.maxlen = sizeof(int),
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = proc_dointvec
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
.procname = "tcp_max_orphans",
|
.procname = "tcp_max_orphans",
|
||||||
.data = &sysctl_tcp_max_orphans,
|
.data = &sysctl_tcp_max_orphans,
|
||||||
|
@ -960,6 +953,13 @@ static struct ctl_table ipv4_net_table[] = {
|
||||||
.extra1 = &tcp_syn_retries_min,
|
.extra1 = &tcp_syn_retries_min,
|
||||||
.extra2 = &tcp_syn_retries_max
|
.extra2 = &tcp_syn_retries_max
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.procname = "tcp_synack_retries",
|
||||||
|
.data = &init_net.ipv4.sysctl_tcp_synack_retries,
|
||||||
|
.maxlen = sizeof(int),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_dointvec
|
||||||
|
},
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2389,6 +2389,7 @@ static int __net_init tcp_sk_init(struct net *net)
|
||||||
net->ipv4.sysctl_tcp_keepalive_intvl = TCP_KEEPALIVE_INTVL;
|
net->ipv4.sysctl_tcp_keepalive_intvl = TCP_KEEPALIVE_INTVL;
|
||||||
|
|
||||||
net->ipv4.sysctl_tcp_syn_retries = TCP_SYN_RETRIES;
|
net->ipv4.sysctl_tcp_syn_retries = TCP_SYN_RETRIES;
|
||||||
|
net->ipv4.sysctl_tcp_synack_retries = TCP_SYNACK_RETRIES;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
fail:
|
fail:
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <linux/gfp.h>
|
#include <linux/gfp.h>
|
||||||
#include <net/tcp.h>
|
#include <net/tcp.h>
|
||||||
|
|
||||||
int sysctl_tcp_synack_retries __read_mostly = TCP_SYNACK_RETRIES;
|
|
||||||
int sysctl_tcp_retries1 __read_mostly = TCP_RETR1;
|
int sysctl_tcp_retries1 __read_mostly = TCP_RETR1;
|
||||||
int sysctl_tcp_retries2 __read_mostly = TCP_RETR2;
|
int sysctl_tcp_retries2 __read_mostly = TCP_RETR2;
|
||||||
int sysctl_tcp_orphan_retries __read_mostly;
|
int sysctl_tcp_orphan_retries __read_mostly;
|
||||||
|
@ -332,7 +331,7 @@ static void tcp_fastopen_synack_timer(struct sock *sk)
|
||||||
{
|
{
|
||||||
struct inet_connection_sock *icsk = inet_csk(sk);
|
struct inet_connection_sock *icsk = inet_csk(sk);
|
||||||
int max_retries = icsk->icsk_syn_retries ? :
|
int max_retries = icsk->icsk_syn_retries ? :
|
||||||
sysctl_tcp_synack_retries + 1; /* add one more retry for fastopen */
|
sock_net(sk)->ipv4.sysctl_tcp_synack_retries + 1; /* add one more retry for fastopen */
|
||||||
struct request_sock *req;
|
struct request_sock *req;
|
||||||
|
|
||||||
req = tcp_sk(sk)->fastopen_rsk;
|
req = tcp_sk(sk)->fastopen_rsk;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче