diff options
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 49 |
1 files changed, 5 insertions, 44 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 6cc67ed6c2e6..61175cb2478f 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -277,22 +277,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
277 | rt = (struct rt6_info *) dst; | 277 | rt = (struct rt6_info *) dst; |
278 | if (tcp_death_row.sysctl_tw_recycle && | 278 | if (tcp_death_row.sysctl_tw_recycle && |
279 | !tp->rx_opt.ts_recent_stamp && | 279 | !tp->rx_opt.ts_recent_stamp && |
280 | ipv6_addr_equal(&rt->rt6i_dst.addr, &np->daddr)) { | 280 | ipv6_addr_equal(&rt->rt6i_dst.addr, &np->daddr)) |
281 | struct inet_peer *peer = rt6_get_peer(rt); | 281 | tcp_fetch_timewait_stamp(sk, dst); |
282 | /* | ||
283 | * VJ's idea. We save last timestamp seen from | ||
284 | * the destination in peer table, when entering state | ||
285 | * TIME-WAIT * and initialize rx_opt.ts_recent from it, | ||
286 | * when trying new connection. | ||
287 | */ | ||
288 | if (peer) { | ||
289 | inet_peer_refcheck(peer); | ||
290 | if ((u32)get_seconds() - peer->tcp_ts_stamp <= TCP_PAWS_MSL) { | ||
291 | tp->rx_opt.ts_recent_stamp = peer->tcp_ts_stamp; | ||
292 | tp->rx_opt.ts_recent = peer->tcp_ts; | ||
293 | } | ||
294 | } | ||
295 | } | ||
296 | 282 | ||
297 | icsk->icsk_ext_hdr_len = 0; | 283 | icsk->icsk_ext_hdr_len = 0; |
298 | if (np->opt) | 284 | if (np->opt) |
@@ -1134,8 +1120,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1134 | treq->iif = inet6_iif(skb); | 1120 | treq->iif = inet6_iif(skb); |
1135 | 1121 | ||
1136 | if (!isn) { | 1122 | if (!isn) { |
1137 | struct inet_peer *peer = NULL; | ||
1138 | |||
1139 | if (ipv6_opt_accepted(sk, skb) || | 1123 | if (ipv6_opt_accepted(sk, skb) || |
1140 | np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || | 1124 | np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || |
1141 | np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) { | 1125 | np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) { |
@@ -1160,14 +1144,8 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1160 | */ | 1144 | */ |
1161 | if (tmp_opt.saw_tstamp && | 1145 | if (tmp_opt.saw_tstamp && |
1162 | tcp_death_row.sysctl_tw_recycle && | 1146 | tcp_death_row.sysctl_tw_recycle && |
1163 | (dst = inet6_csk_route_req(sk, &fl6, req)) != NULL && | 1147 | (dst = inet6_csk_route_req(sk, &fl6, req)) != NULL) { |
1164 | (peer = rt6_get_peer((struct rt6_info *)dst)) != NULL && | 1148 | if (!tcp_peer_is_proven(req, dst, true)) { |
1165 | ipv6_addr_equal((struct in6_addr *)peer->daddr.addr.a6, | ||
1166 | &treq->rmt_addr)) { | ||
1167 | inet_peer_refcheck(peer); | ||
1168 | if ((u32)get_seconds() - peer->tcp_ts_stamp < TCP_PAWS_MSL && | ||
1169 | (s32)(peer->tcp_ts - req->ts_recent) > | ||
1170 | TCP_PAWS_WINDOW) { | ||
1171 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_PAWSPASSIVEREJECTED); | 1149 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_PAWSPASSIVEREJECTED); |
1172 | goto drop_and_release; | 1150 | goto drop_and_release; |
1173 | } | 1151 | } |
@@ -1176,8 +1154,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1176 | else if (!sysctl_tcp_syncookies && | 1154 | else if (!sysctl_tcp_syncookies && |
1177 | (sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) < | 1155 | (sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) < |
1178 | (sysctl_max_syn_backlog >> 2)) && | 1156 | (sysctl_max_syn_backlog >> 2)) && |
1179 | (!peer || !peer->tcp_ts_stamp) && | 1157 | !tcp_peer_is_proven(req, dst, false)) { |
1180 | (!dst || !dst_metric(dst, RTAX_RTT))) { | ||
1181 | /* Without syncookies last quarter of | 1158 | /* Without syncookies last quarter of |
1182 | * backlog is filled with destinations, | 1159 | * backlog is filled with destinations, |
1183 | * proven to be alive. | 1160 | * proven to be alive. |
@@ -1712,20 +1689,6 @@ do_time_wait: | |||
1712 | goto discard_it; | 1689 | goto discard_it; |
1713 | } | 1690 | } |
1714 | 1691 | ||
1715 | static struct inet_peer *tcp_v6_get_peer(struct sock *sk) | ||
1716 | { | ||
1717 | struct rt6_info *rt = (struct rt6_info *) __sk_dst_get(sk); | ||
1718 | struct ipv6_pinfo *np = inet6_sk(sk); | ||
1719 | |||
1720 | /* If we don't have a valid cached route, or we're doing IP | ||
1721 | * options which make the IPv6 header destination address | ||
1722 | * different from our peer's, do not bother with this. | ||
1723 | */ | ||
1724 | if (!rt || !ipv6_addr_equal(&np->daddr, &rt->rt6i_dst.addr)) | ||
1725 | return NULL; | ||
1726 | return rt6_get_peer_create(rt); | ||
1727 | } | ||
1728 | |||
1729 | static struct timewait_sock_ops tcp6_timewait_sock_ops = { | 1692 | static struct timewait_sock_ops tcp6_timewait_sock_ops = { |
1730 | .twsk_obj_size = sizeof(struct tcp6_timewait_sock), | 1693 | .twsk_obj_size = sizeof(struct tcp6_timewait_sock), |
1731 | .twsk_unique = tcp_twsk_unique, | 1694 | .twsk_unique = tcp_twsk_unique, |
@@ -1738,7 +1701,6 @@ static const struct inet_connection_sock_af_ops ipv6_specific = { | |||
1738 | .rebuild_header = inet6_sk_rebuild_header, | 1701 | .rebuild_header = inet6_sk_rebuild_header, |
1739 | .conn_request = tcp_v6_conn_request, | 1702 | .conn_request = tcp_v6_conn_request, |
1740 | .syn_recv_sock = tcp_v6_syn_recv_sock, | 1703 | .syn_recv_sock = tcp_v6_syn_recv_sock, |
1741 | .get_peer = tcp_v6_get_peer, | ||
1742 | .net_header_len = sizeof(struct ipv6hdr), | 1704 | .net_header_len = sizeof(struct ipv6hdr), |
1743 | .net_frag_header_len = sizeof(struct frag_hdr), | 1705 | .net_frag_header_len = sizeof(struct frag_hdr), |
1744 | .setsockopt = ipv6_setsockopt, | 1706 | .setsockopt = ipv6_setsockopt, |
@@ -1770,7 +1732,6 @@ static const struct inet_connection_sock_af_ops ipv6_mapped = { | |||
1770 | .rebuild_header = inet_sk_rebuild_header, | 1732 | .rebuild_header = inet_sk_rebuild_header, |
1771 | .conn_request = tcp_v6_conn_request, | 1733 | .conn_request = tcp_v6_conn_request, |
1772 | .syn_recv_sock = tcp_v6_syn_recv_sock, | 1734 | .syn_recv_sock = tcp_v6_syn_recv_sock, |
1773 | .get_peer = tcp_v4_get_peer, | ||
1774 | .net_header_len = sizeof(struct iphdr), | 1735 | .net_header_len = sizeof(struct iphdr), |
1775 | .setsockopt = ipv6_setsockopt, | 1736 | .setsockopt = ipv6_setsockopt, |
1776 | .getsockopt = ipv6_getsockopt, | 1737 | .getsockopt = ipv6_getsockopt, |