diff options
-rw-r--r-- | include/net/tcp.h | 1 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_metrics.c | 10 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 2 |
4 files changed, 13 insertions, 2 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 98ca797001a2..5478356ea8c5 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -389,6 +389,7 @@ extern void tcp_enter_loss(struct sock *sk, int how); | |||
389 | extern void tcp_clear_retrans(struct tcp_sock *tp); | 389 | extern void tcp_clear_retrans(struct tcp_sock *tp); |
390 | extern void tcp_update_metrics(struct sock *sk); | 390 | extern void tcp_update_metrics(struct sock *sk); |
391 | extern void tcp_init_metrics(struct sock *sk); | 391 | extern void tcp_init_metrics(struct sock *sk); |
392 | extern bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst); | ||
392 | extern void tcp_disable_fack(struct tcp_sock *tp); | 393 | extern void tcp_disable_fack(struct tcp_sock *tp); |
393 | extern void tcp_close(struct sock *sk, long timeout); | 394 | extern void tcp_close(struct sock *sk, long timeout); |
394 | extern void tcp_init_sock(struct sock *sk); | 395 | extern void tcp_init_sock(struct sock *sk); |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 64568fa21d05..e9312a8f33a1 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1405,7 +1405,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1405 | (sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) < | 1405 | (sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) < |
1406 | (sysctl_max_syn_backlog >> 2)) && | 1406 | (sysctl_max_syn_backlog >> 2)) && |
1407 | (!peer || !peer->tcp_ts_stamp) && | 1407 | (!peer || !peer->tcp_ts_stamp) && |
1408 | (!dst || !dst_metric(dst, RTAX_RTT))) { | 1408 | !tcp_peer_is_proven(req, dst)) { |
1409 | /* Without syncookies last quarter of | 1409 | /* Without syncookies last quarter of |
1410 | * backlog is filled with destinations, | 1410 | * backlog is filled with destinations, |
1411 | * proven to be alive. | 1411 | * proven to be alive. |
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c index 2793ecf928d3..9afe703c85cc 100644 --- a/net/ipv4/tcp_metrics.c +++ b/net/ipv4/tcp_metrics.c | |||
@@ -1,7 +1,9 @@ | |||
1 | #include <linux/module.h> | ||
1 | #include <linux/cache.h> | 2 | #include <linux/cache.h> |
2 | #include <linux/tcp.h> | 3 | #include <linux/tcp.h> |
3 | 4 | ||
4 | #include <net/inet_connection_sock.h> | 5 | #include <net/inet_connection_sock.h> |
6 | #include <net/request_sock.h> | ||
5 | #include <net/sock.h> | 7 | #include <net/sock.h> |
6 | #include <net/dst.h> | 8 | #include <net/dst.h> |
7 | #include <net/tcp.h> | 9 | #include <net/tcp.h> |
@@ -190,3 +192,11 @@ reset: | |||
190 | tp->snd_cwnd = tcp_init_cwnd(tp, dst); | 192 | tp->snd_cwnd = tcp_init_cwnd(tp, dst); |
191 | tp->snd_cwnd_stamp = tcp_time_stamp; | 193 | tp->snd_cwnd_stamp = tcp_time_stamp; |
192 | } | 194 | } |
195 | |||
196 | bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst) | ||
197 | { | ||
198 | if (!dst) | ||
199 | return false; | ||
200 | return dst_metric(dst, RTAX_RTT) ? true : false; | ||
201 | } | ||
202 | EXPORT_SYMBOL_GPL(tcp_peer_is_proven); | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 6cc67ed6c2e6..75d179555c28 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1177,7 +1177,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1177 | (sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) < | 1177 | (sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) < |
1178 | (sysctl_max_syn_backlog >> 2)) && | 1178 | (sysctl_max_syn_backlog >> 2)) && |
1179 | (!peer || !peer->tcp_ts_stamp) && | 1179 | (!peer || !peer->tcp_ts_stamp) && |
1180 | (!dst || !dst_metric(dst, RTAX_RTT))) { | 1180 | !tcp_peer_is_proven(req, dst)) { |
1181 | /* Without syncookies last quarter of | 1181 | /* Without syncookies last quarter of |
1182 | * backlog is filled with destinations, | 1182 | * backlog is filled with destinations, |
1183 | * proven to be alive. | 1183 | * proven to be alive. |