diff options
author | Haishuang Yan <yanhaishuang@cmss.chinamobile.com> | 2016-12-28 04:52:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-12-29 11:38:31 -0500 |
commit | 1946e672c173559155a3e210fe95dbf8b7b8ddf7 (patch) | |
tree | 0d794dc28150aac130c2e6dd0024cb3a4a5ec594 /net/ipv6/tcp_ipv6.c | |
parent | 801822d1beea4f11a38df991b420ca917f6a917b (diff) |
ipv4: Namespaceify tcp_tw_recycle and tcp_max_tw_buckets knob
Different namespace application might require fast recycling
TIME-WAIT sockets independently of the host.
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 73bc8fc68acd..a4cdf6a34c30 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -123,6 +123,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
123 | struct dst_entry *dst; | 123 | struct dst_entry *dst; |
124 | int addr_type; | 124 | int addr_type; |
125 | int err; | 125 | int err; |
126 | struct inet_timewait_death_row *tcp_death_row = &sock_net(sk)->ipv4.tcp_death_row; | ||
126 | 127 | ||
127 | if (addr_len < SIN6_LEN_RFC2133) | 128 | if (addr_len < SIN6_LEN_RFC2133) |
128 | return -EINVAL; | 129 | return -EINVAL; |
@@ -258,7 +259,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
258 | sk->sk_gso_type = SKB_GSO_TCPV6; | 259 | sk->sk_gso_type = SKB_GSO_TCPV6; |
259 | ip6_dst_store(sk, dst, NULL, NULL); | 260 | ip6_dst_store(sk, dst, NULL, NULL); |
260 | 261 | ||
261 | if (tcp_death_row.sysctl_tw_recycle && | 262 | if (tcp_death_row->sysctl_tw_recycle && |
262 | !tp->rx_opt.ts_recent_stamp && | 263 | !tp->rx_opt.ts_recent_stamp && |
263 | ipv6_addr_equal(&fl6.daddr, &sk->sk_v6_daddr)) | 264 | ipv6_addr_equal(&fl6.daddr, &sk->sk_v6_daddr)) |
264 | tcp_fetch_timewait_stamp(sk, dst); | 265 | tcp_fetch_timewait_stamp(sk, dst); |
@@ -273,7 +274,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
273 | inet->inet_dport = usin->sin6_port; | 274 | inet->inet_dport = usin->sin6_port; |
274 | 275 | ||
275 | tcp_set_state(sk, TCP_SYN_SENT); | 276 | tcp_set_state(sk, TCP_SYN_SENT); |
276 | err = inet6_hash_connect(&tcp_death_row, sk); | 277 | err = inet6_hash_connect(tcp_death_row, sk); |
277 | if (err) | 278 | if (err) |
278 | goto late_failure; | 279 | goto late_failure; |
279 | 280 | ||
@@ -1948,7 +1949,7 @@ static void __net_exit tcpv6_net_exit(struct net *net) | |||
1948 | 1949 | ||
1949 | static void __net_exit tcpv6_net_exit_batch(struct list_head *net_exit_list) | 1950 | static void __net_exit tcpv6_net_exit_batch(struct list_head *net_exit_list) |
1950 | { | 1951 | { |
1951 | inet_twsk_purge(&tcp_hashinfo, &tcp_death_row, AF_INET6); | 1952 | inet_twsk_purge(&tcp_hashinfo, AF_INET6); |
1952 | } | 1953 | } |
1953 | 1954 | ||
1954 | static struct pernet_operations tcpv6_net_ops = { | 1955 | static struct pernet_operations tcpv6_net_ops = { |