diff options
-rw-r--r-- | include/net/netns/ipv4.h | 1 | ||||
-rw-r--r-- | include/net/request_sock.h | 4 | ||||
-rw-r--r-- | net/core/request_sock.c | 2 | ||||
-rw-r--r-- | net/ipv4/sysctl_net_ipv4.c | 14 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 4 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 7 |
7 files changed, 16 insertions, 18 deletions
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index fffd38453985..8e3f5b6f26d5 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
@@ -122,6 +122,7 @@ struct netns_ipv4 { | |||
122 | unsigned int sysctl_tcp_notsent_lowat; | 122 | unsigned int sysctl_tcp_notsent_lowat; |
123 | int sysctl_tcp_tw_reuse; | 123 | int sysctl_tcp_tw_reuse; |
124 | struct inet_timewait_death_row tcp_death_row; | 124 | struct inet_timewait_death_row tcp_death_row; |
125 | int sysctl_max_syn_backlog; | ||
125 | 126 | ||
126 | int sysctl_igmp_max_memberships; | 127 | int sysctl_igmp_max_memberships; |
127 | int sysctl_igmp_max_msf; | 128 | int sysctl_igmp_max_msf; |
diff --git a/include/net/request_sock.h b/include/net/request_sock.h index 6ebe13eb1c4c..a12a5d25b27e 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * NET Generic infrastructure for Network protocols. | 2 | * NET Generic infrastructure for Network protocols. |
3 | * | 3 | * |
4 | * Definitions for request_sock | 4 | * Definitions for request_sock |
5 | * | 5 | * |
6 | * Authors: Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 6 | * Authors: Arnaldo Carvalho de Melo <acme@conectiva.com.br> |
7 | * | 7 | * |
@@ -123,8 +123,6 @@ static inline void reqsk_put(struct request_sock *req) | |||
123 | reqsk_free(req); | 123 | reqsk_free(req); |
124 | } | 124 | } |
125 | 125 | ||
126 | extern int sysctl_max_syn_backlog; | ||
127 | |||
128 | /* | 126 | /* |
129 | * For a TCP Fast Open listener - | 127 | * For a TCP Fast Open listener - |
130 | * lock - protects the access to all the reqsk, which is co-owned by | 128 | * lock - protects the access to all the reqsk, which is co-owned by |
diff --git a/net/core/request_sock.c b/net/core/request_sock.c index 5d26056b6d8f..9b8727c67b58 100644 --- a/net/core/request_sock.c +++ b/net/core/request_sock.c | |||
@@ -34,8 +34,6 @@ | |||
34 | * and it will increase in proportion to the memory of machine. | 34 | * and it will increase in proportion to the memory of machine. |
35 | * Note : Dont forget somaxconn that may limit backlog too. | 35 | * Note : Dont forget somaxconn that may limit backlog too. |
36 | */ | 36 | */ |
37 | int sysctl_max_syn_backlog = 256; | ||
38 | EXPORT_SYMBOL(sysctl_max_syn_backlog); | ||
39 | 37 | ||
40 | void reqsk_queue_alloc(struct request_sock_queue *queue) | 38 | void reqsk_queue_alloc(struct request_sock_queue *queue) |
41 | { | 39 | { |
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 66f8f1b1dc78..134d8e191366 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -324,13 +324,6 @@ static struct ctl_table ipv4_table[] = { | |||
324 | .proc_handler = proc_dointvec | 324 | .proc_handler = proc_dointvec |
325 | }, | 325 | }, |
326 | { | 326 | { |
327 | .procname = "tcp_max_syn_backlog", | ||
328 | .data = &sysctl_max_syn_backlog, | ||
329 | .maxlen = sizeof(int), | ||
330 | .mode = 0644, | ||
331 | .proc_handler = proc_dointvec | ||
332 | }, | ||
333 | { | ||
334 | .procname = "inet_peer_threshold", | 327 | .procname = "inet_peer_threshold", |
335 | .data = &inet_peer_threshold, | 328 | .data = &inet_peer_threshold, |
336 | .maxlen = sizeof(int), | 329 | .maxlen = sizeof(int), |
@@ -960,6 +953,13 @@ static struct ctl_table ipv4_net_table[] = { | |||
960 | .mode = 0644, | 953 | .mode = 0644, |
961 | .proc_handler = proc_dointvec | 954 | .proc_handler = proc_dointvec |
962 | }, | 955 | }, |
956 | { | ||
957 | .procname = "tcp_max_syn_backlog", | ||
958 | .data = &init_net.ipv4.sysctl_max_syn_backlog, | ||
959 | .maxlen = sizeof(int), | ||
960 | .mode = 0644, | ||
961 | .proc_handler = proc_dointvec | ||
962 | }, | ||
963 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 963 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
964 | { | 964 | { |
965 | .procname = "fib_multipath_use_neigh", | 965 | .procname = "fib_multipath_use_neigh", |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 7f0d81c090ce..2e3807d8eba8 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -3378,9 +3378,7 @@ void __init tcp_init(void) | |||
3378 | 3378 | ||
3379 | 3379 | ||
3380 | cnt = tcp_hashinfo.ehash_mask + 1; | 3380 | cnt = tcp_hashinfo.ehash_mask + 1; |
3381 | |||
3382 | sysctl_tcp_max_orphans = cnt / 2; | 3381 | sysctl_tcp_max_orphans = cnt / 2; |
3383 | sysctl_max_syn_backlog = max(128, cnt / 256); | ||
3384 | 3382 | ||
3385 | tcp_init_mem(); | 3383 | tcp_init_mem(); |
3386 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ | 3384 | /* Set per-socket limits to no more than 1/128 the pressure threshold */ |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index c61480249835..ec6d84363024 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -6377,8 +6377,8 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops, | |||
6377 | } | 6377 | } |
6378 | /* Kill the following clause, if you dislike this way. */ | 6378 | /* Kill the following clause, if you dislike this way. */ |
6379 | else if (!net->ipv4.sysctl_tcp_syncookies && | 6379 | else if (!net->ipv4.sysctl_tcp_syncookies && |
6380 | (sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) < | 6380 | (net->ipv4.sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) < |
6381 | (sysctl_max_syn_backlog >> 2)) && | 6381 | (net->ipv4.sysctl_max_syn_backlog >> 2)) && |
6382 | !tcp_peer_is_proven(req, dst, false, | 6382 | !tcp_peer_is_proven(req, dst, false, |
6383 | tmp_opt.saw_tstamp)) { | 6383 | tmp_opt.saw_tstamp)) { |
6384 | /* Without syncookies last quarter of | 6384 | /* Without syncookies last quarter of |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 56b5f49e3f97..7e4be4f361f3 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -2419,7 +2419,7 @@ static void __net_exit tcp_sk_exit(struct net *net) | |||
2419 | 2419 | ||
2420 | static int __net_init tcp_sk_init(struct net *net) | 2420 | static int __net_init tcp_sk_init(struct net *net) |
2421 | { | 2421 | { |
2422 | int res, cpu; | 2422 | int res, cpu, cnt; |
2423 | 2423 | ||
2424 | net->ipv4.tcp_sk = alloc_percpu(struct sock *); | 2424 | net->ipv4.tcp_sk = alloc_percpu(struct sock *); |
2425 | if (!net->ipv4.tcp_sk) | 2425 | if (!net->ipv4.tcp_sk) |
@@ -2458,10 +2458,13 @@ static int __net_init tcp_sk_init(struct net *net) | |||
2458 | net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX; | 2458 | net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX; |
2459 | net->ipv4.sysctl_tcp_tw_reuse = 0; | 2459 | net->ipv4.sysctl_tcp_tw_reuse = 0; |
2460 | 2460 | ||
2461 | cnt = tcp_hashinfo.ehash_mask + 1; | ||
2461 | net->ipv4.tcp_death_row.sysctl_tw_recycle = 0; | 2462 | net->ipv4.tcp_death_row.sysctl_tw_recycle = 0; |
2462 | net->ipv4.tcp_death_row.sysctl_max_tw_buckets = (tcp_hashinfo.ehash_mask + 1) / 2; | 2463 | net->ipv4.tcp_death_row.sysctl_max_tw_buckets = (cnt + 1) / 2; |
2463 | net->ipv4.tcp_death_row.hashinfo = &tcp_hashinfo; | 2464 | net->ipv4.tcp_death_row.hashinfo = &tcp_hashinfo; |
2464 | 2465 | ||
2466 | net->ipv4.sysctl_max_syn_backlog = max(128, cnt / 256); | ||
2467 | |||
2465 | return 0; | 2468 | return 0; |
2466 | fail: | 2469 | fail: |
2467 | tcp_sk_exit(net); | 2470 | tcp_sk_exit(net); |