diff options
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index e5c8a669e84e..514b57bb80b7 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <net/addrconf.h> | 60 | #include <net/addrconf.h> |
61 | #include <net/snmp.h> | 61 | #include <net/snmp.h> |
62 | #include <net/dsfield.h> | 62 | #include <net/dsfield.h> |
63 | #include <net/timewait_sock.h> | ||
63 | 64 | ||
64 | #include <asm/uaccess.h> | 65 | #include <asm/uaccess.h> |
65 | 66 | ||
@@ -147,22 +148,9 @@ static int __tcp_v6_check_established(struct sock *sk, const __u16 lport, | |||
147 | ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) && | 148 | ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) && |
148 | ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) && | 149 | ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) && |
149 | sk2->sk_bound_dev_if == sk->sk_bound_dev_if) { | 150 | sk2->sk_bound_dev_if == sk->sk_bound_dev_if) { |
150 | const struct tcp_timewait_sock *tcptw = tcp_twsk(sk2); | 151 | if (twsk_unique(sk, sk2, twp)) |
151 | struct tcp_sock *tp = tcp_sk(sk); | ||
152 | |||
153 | if (tcptw->tw_ts_recent_stamp && | ||
154 | (!twp || | ||
155 | (sysctl_tcp_tw_reuse && | ||
156 | xtime.tv_sec - tcptw->tw_ts_recent_stamp > 1))) { | ||
157 | /* See comment in tcp_ipv4.c */ | ||
158 | tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2; | ||
159 | if (!tp->write_seq) | ||
160 | tp->write_seq = 1; | ||
161 | tp->rx_opt.ts_recent = tcptw->tw_ts_recent; | ||
162 | tp->rx_opt.ts_recent_stamp = tcptw->tw_ts_recent_stamp; | ||
163 | sock_hold(sk2); | ||
164 | goto unique; | 152 | goto unique; |
165 | } else | 153 | else |
166 | goto not_unique; | 154 | goto not_unique; |
167 | } | 155 | } |
168 | } | 156 | } |
@@ -711,6 +699,11 @@ static struct request_sock_ops tcp6_request_sock_ops = { | |||
711 | .send_reset = tcp_v6_send_reset | 699 | .send_reset = tcp_v6_send_reset |
712 | }; | 700 | }; |
713 | 701 | ||
702 | static struct timewait_sock_ops tcp6_timewait_sock_ops = { | ||
703 | .twsk_obj_size = sizeof(struct tcp6_timewait_sock), | ||
704 | .twsk_unique = tcp_twsk_unique, | ||
705 | }; | ||
706 | |||
714 | static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb) | 707 | static void tcp_v6_send_check(struct sock *sk, int len, struct sk_buff *skb) |
715 | { | 708 | { |
716 | struct ipv6_pinfo *np = inet6_sk(sk); | 709 | struct ipv6_pinfo *np = inet6_sk(sk); |
@@ -1752,7 +1745,7 @@ struct proto tcpv6_prot = { | |||
1752 | .sysctl_rmem = sysctl_tcp_rmem, | 1745 | .sysctl_rmem = sysctl_tcp_rmem, |
1753 | .max_header = MAX_TCP_HEADER, | 1746 | .max_header = MAX_TCP_HEADER, |
1754 | .obj_size = sizeof(struct tcp6_sock), | 1747 | .obj_size = sizeof(struct tcp6_sock), |
1755 | .twsk_obj_size = sizeof(struct tcp6_timewait_sock), | 1748 | .twsk_prot = &tcp6_timewait_sock_ops, |
1756 | .rsk_prot = &tcp6_request_sock_ops, | 1749 | .rsk_prot = &tcp6_request_sock_ops, |
1757 | }; | 1750 | }; |
1758 | 1751 | ||