aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/tcp.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r--include/net/tcp.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index d74ac301e6bc..255ca35bea05 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -997,11 +997,21 @@ static inline int tcp_fin_time(const struct sock *sk)
997 return fin_timeout; 997 return fin_timeout;
998} 998}
999 999
1000static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, int rst) 1000static inline int tcp_paws_check(const struct tcp_options_received *rx_opt,
1001 int paws_win)
1001{ 1002{
1002 if ((s32)(rx_opt->rcv_tsval - rx_opt->ts_recent) >= 0) 1003 if ((s32)(rx_opt->ts_recent - rx_opt->rcv_tsval) <= paws_win)
1003 return 0; 1004 return 1;
1004 if (get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS) 1005 if (unlikely(get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS))
1006 return 1;
1007
1008 return 0;
1009}
1010
1011static inline int tcp_paws_reject(const struct tcp_options_received *rx_opt,
1012 int rst)
1013{
1014 if (tcp_paws_check(rx_opt, 0))
1005 return 0; 1015 return 0;
1006 1016
1007 /* RST segments are not recommended to carry timestamp, 1017 /* RST segments are not recommended to carry timestamp,