mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
tcp: Move timestamps from inetpeer to metrics cache.
With help from Lin Ming. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
94334d5ed4
commit
81166dd6fa
9 changed files with 149 additions and 127 deletions
|
@ -277,22 +277,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
|
|||
rt = (struct rt6_info *) dst;
|
||||
if (tcp_death_row.sysctl_tw_recycle &&
|
||||
!tp->rx_opt.ts_recent_stamp &&
|
||||
ipv6_addr_equal(&rt->rt6i_dst.addr, &np->daddr)) {
|
||||
struct inet_peer *peer = rt6_get_peer(rt);
|
||||
/*
|
||||
* VJ's idea. We save last timestamp seen from
|
||||
* the destination in peer table, when entering state
|
||||
* TIME-WAIT * and initialize rx_opt.ts_recent from it,
|
||||
* when trying new connection.
|
||||
*/
|
||||
if (peer) {
|
||||
inet_peer_refcheck(peer);
|
||||
if ((u32)get_seconds() - peer->tcp_ts_stamp <= TCP_PAWS_MSL) {
|
||||
tp->rx_opt.ts_recent_stamp = peer->tcp_ts_stamp;
|
||||
tp->rx_opt.ts_recent = peer->tcp_ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
ipv6_addr_equal(&rt->rt6i_dst.addr, &np->daddr))
|
||||
tcp_fetch_timewait_stamp(sk, dst);
|
||||
|
||||
icsk->icsk_ext_hdr_len = 0;
|
||||
if (np->opt)
|
||||
|
@ -1134,8 +1120,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
|
|||
treq->iif = inet6_iif(skb);
|
||||
|
||||
if (!isn) {
|
||||
struct inet_peer *peer = NULL;
|
||||
|
||||
if (ipv6_opt_accepted(sk, skb) ||
|
||||
np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo ||
|
||||
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)
|
|||
*/
|
||||
if (tmp_opt.saw_tstamp &&
|
||||
tcp_death_row.sysctl_tw_recycle &&
|
||||
(dst = inet6_csk_route_req(sk, &fl6, req)) != NULL &&
|
||||
(peer = rt6_get_peer((struct rt6_info *)dst)) != NULL &&
|
||||
ipv6_addr_equal((struct in6_addr *)peer->daddr.addr.a6,
|
||||
&treq->rmt_addr)) {
|
||||
inet_peer_refcheck(peer);
|
||||
if ((u32)get_seconds() - peer->tcp_ts_stamp < TCP_PAWS_MSL &&
|
||||
(s32)(peer->tcp_ts - req->ts_recent) >
|
||||
TCP_PAWS_WINDOW) {
|
||||
(dst = inet6_csk_route_req(sk, &fl6, req)) != NULL) {
|
||||
if (!tcp_peer_is_proven(req, dst, true)) {
|
||||
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_PAWSPASSIVEREJECTED);
|
||||
goto drop_and_release;
|
||||
}
|
||||
|
@ -1176,8 +1154,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
|
|||
else if (!sysctl_tcp_syncookies &&
|
||||
(sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) <
|
||||
(sysctl_max_syn_backlog >> 2)) &&
|
||||
(!peer || !peer->tcp_ts_stamp) &&
|
||||
!tcp_peer_is_proven(req, dst)) {
|
||||
!tcp_peer_is_proven(req, dst, false)) {
|
||||
/* Without syncookies last quarter of
|
||||
* backlog is filled with destinations,
|
||||
* proven to be alive.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue