aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcp_ipv6.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-07-10 06:14:24 -0400
committerDavid S. Miller <davem@davemloft.net>2012-07-11 01:40:08 -0400
commit81166dd6fa8eb780b2132d32fbc77eb6ac04e44e (patch)
tree7a41b12950640648d3bb95ca74bfa1391efa0421 /net/ipv6/tcp_ipv6.c
parent94334d5ed4b64ebcd2c4b421e133b921f8ccf75d (diff)
tcp: Move timestamps from inetpeer to metrics cache.
With help from Lin Ming. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r--net/ipv6/tcp_ipv6.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 75d179555c28..9e96b5f21d2a 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 !tcp_peer_is_proven(req, dst)) {
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.