diff options
| -rw-r--r-- | include/net/tcp.h | 2 | ||||
| -rw-r--r-- | net/ipv4/tcp_input.c | 9 | ||||
| -rw-r--r-- | net/ipv4/tcp_metrics.c | 6 |
3 files changed, 11 insertions, 6 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index e337e05035be..590e01a476ac 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
| @@ -417,7 +417,7 @@ void tcp_update_metrics(struct sock *sk); | |||
| 417 | void tcp_init_metrics(struct sock *sk); | 417 | void tcp_init_metrics(struct sock *sk); |
| 418 | void tcp_metrics_init(void); | 418 | void tcp_metrics_init(void); |
| 419 | bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, | 419 | bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, |
| 420 | bool paws_check); | 420 | bool paws_check, bool timestamps); |
| 421 | bool tcp_remember_stamp(struct sock *sk); | 421 | bool tcp_remember_stamp(struct sock *sk); |
| 422 | bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw); | 422 | bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw); |
| 423 | void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst); | 423 | void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 1a8e89fdd331..4f6cfbc57775 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
| @@ -5979,12 +5979,14 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops, | |||
| 5979 | * timewait bucket, so that all the necessary checks | 5979 | * timewait bucket, so that all the necessary checks |
| 5980 | * are made in the function processing timewait state. | 5980 | * are made in the function processing timewait state. |
| 5981 | */ | 5981 | */ |
| 5982 | if (tmp_opt.saw_tstamp && tcp_death_row.sysctl_tw_recycle) { | 5982 | if (tcp_death_row.sysctl_tw_recycle) { |
| 5983 | bool strict; | 5983 | bool strict; |
| 5984 | 5984 | ||
| 5985 | dst = af_ops->route_req(sk, &fl, req, &strict); | 5985 | dst = af_ops->route_req(sk, &fl, req, &strict); |
| 5986 | |||
| 5986 | if (dst && strict && | 5987 | if (dst && strict && |
| 5987 | !tcp_peer_is_proven(req, dst, true)) { | 5988 | !tcp_peer_is_proven(req, dst, true, |
| 5989 | tmp_opt.saw_tstamp)) { | ||
| 5988 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_PAWSPASSIVEREJECTED); | 5990 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_PAWSPASSIVEREJECTED); |
| 5989 | goto drop_and_release; | 5991 | goto drop_and_release; |
| 5990 | } | 5992 | } |
| @@ -5993,7 +5995,8 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops, | |||
| 5993 | else if (!sysctl_tcp_syncookies && | 5995 | else if (!sysctl_tcp_syncookies && |
| 5994 | (sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) < | 5996 | (sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) < |
| 5995 | (sysctl_max_syn_backlog >> 2)) && | 5997 | (sysctl_max_syn_backlog >> 2)) && |
| 5996 | !tcp_peer_is_proven(req, dst, false)) { | 5998 | !tcp_peer_is_proven(req, dst, false, |
| 5999 | tmp_opt.saw_tstamp)) { | ||
| 5997 | /* Without syncookies last quarter of | 6000 | /* Without syncookies last quarter of |
| 5998 | * backlog is filled with destinations, | 6001 | * backlog is filled with destinations, |
| 5999 | * proven to be alive. | 6002 | * proven to be alive. |
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c index 0d54e59b9ea8..ed9c9a91851c 100644 --- a/net/ipv4/tcp_metrics.c +++ b/net/ipv4/tcp_metrics.c | |||
| @@ -576,7 +576,8 @@ reset: | |||
| 576 | tp->snd_cwnd_stamp = tcp_time_stamp; | 576 | tp->snd_cwnd_stamp = tcp_time_stamp; |
| 577 | } | 577 | } |
| 578 | 578 | ||
| 579 | bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool paws_check) | 579 | bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, |
| 580 | bool paws_check, bool timestamps) | ||
| 580 | { | 581 | { |
| 581 | struct tcp_metrics_block *tm; | 582 | struct tcp_metrics_block *tm; |
| 582 | bool ret; | 583 | bool ret; |
| @@ -589,7 +590,8 @@ bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool pa | |||
| 589 | if (paws_check) { | 590 | if (paws_check) { |
| 590 | if (tm && | 591 | if (tm && |
| 591 | (u32)get_seconds() - tm->tcpm_ts_stamp < TCP_PAWS_MSL && | 592 | (u32)get_seconds() - tm->tcpm_ts_stamp < TCP_PAWS_MSL && |
| 592 | (s32)(tm->tcpm_ts - req->ts_recent) > TCP_PAWS_WINDOW) | 593 | ((s32)(tm->tcpm_ts - req->ts_recent) > TCP_PAWS_WINDOW || |
| 594 | !timestamps)) | ||
| 593 | ret = false; | 595 | ret = false; |
| 594 | else | 596 | else |
| 595 | ret = true; | 597 | ret = true; |
