aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
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
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')
-rw-r--r--net/ipv6/route.c13
-rw-r--r--net/ipv6/tcp_ipv6.c33
2 files changed, 6 insertions, 40 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 6cc6c881f54..0c068475378 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2348,13 +2348,11 @@ static int rt6_fill_node(struct net *net,
2348 int iif, int type, u32 pid, u32 seq, 2348 int iif, int type, u32 pid, u32 seq,
2349 int prefix, int nowait, unsigned int flags) 2349 int prefix, int nowait, unsigned int flags)
2350{ 2350{
2351 const struct inet_peer *peer;
2352 struct rtmsg *rtm; 2351 struct rtmsg *rtm;
2353 struct nlmsghdr *nlh; 2352 struct nlmsghdr *nlh;
2354 long expires; 2353 long expires;
2355 u32 table; 2354 u32 table;
2356 struct neighbour *n; 2355 struct neighbour *n;
2357 u32 ts, tsage;
2358 2356
2359 if (prefix) { /* user wants prefix routes only */ 2357 if (prefix) { /* user wants prefix routes only */
2360 if (!(rt->rt6i_flags & RTF_PREFIX_RT)) { 2358 if (!(rt->rt6i_flags & RTF_PREFIX_RT)) {
@@ -2473,16 +2471,7 @@ static int rt6_fill_node(struct net *net,
2473 else 2471 else
2474 expires = INT_MAX; 2472 expires = INT_MAX;
2475 2473
2476 peer = NULL; 2474 if (rtnl_put_cacheinfo(skb, &rt->dst, 0, 0, 0,
2477 if (rt6_has_peer(rt))
2478 peer = rt6_peer_ptr(rt);
2479 ts = tsage = 0;
2480 if (peer && peer->tcp_ts_stamp) {
2481 ts = peer->tcp_ts;
2482 tsage = get_seconds() - peer->tcp_ts_stamp;
2483 }
2484
2485 if (rtnl_put_cacheinfo(skb, &rt->dst, 0, ts, tsage,
2486 expires, rt->dst.error) < 0) 2475 expires, rt->dst.error) < 0)
2487 goto nla_put_failure; 2476 goto nla_put_failure;
2488 2477
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 75d179555c2..9e96b5f21d2 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.