|
@@ -472,19 +472,20 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb);
|
|
|
*/
|
|
|
static inline void tcp_synq_overflow(const struct sock *sk)
|
|
|
{
|
|
|
- unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp;
|
|
|
- unsigned long now = jiffies;
|
|
|
+ unsigned int last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp;
|
|
|
+ unsigned int now = jiffies;
|
|
|
|
|
|
- if (time_after(now, last_overflow + HZ))
|
|
|
+ if (time_after32(now, last_overflow + HZ))
|
|
|
tcp_sk(sk)->rx_opt.ts_recent_stamp = now;
|
|
|
}
|
|
|
|
|
|
/* syncookies: no recent synqueue overflow on this listening socket? */
|
|
|
static inline bool tcp_synq_no_recent_overflow(const struct sock *sk)
|
|
|
{
|
|
|
- unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp;
|
|
|
+ unsigned int last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp;
|
|
|
+ unsigned int now = jiffies;
|
|
|
|
|
|
- return time_after(jiffies, last_overflow + TCP_SYNCOOKIE_VALID);
|
|
|
+ return time_after32(now, last_overflow + TCP_SYNCOOKIE_VALID);
|
|
|
}
|
|
|
|
|
|
static inline u32 tcp_cookie_time(void)
|
|
@@ -1375,7 +1376,8 @@ static inline bool tcp_paws_check(const struct tcp_options_received *rx_opt,
|
|
|
{
|
|
|
if ((s32)(rx_opt->ts_recent - rx_opt->rcv_tsval) <= paws_win)
|
|
|
return true;
|
|
|
- if (unlikely(get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS))
|
|
|
+ if (unlikely(!time_before32(ktime_get_seconds(),
|
|
|
+ rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS)))
|
|
|
return true;
|
|
|
/*
|
|
|
* Some OSes send SYN and SYNACK messages with tsval=0 tsecr=0,
|
|
@@ -1405,7 +1407,8 @@ static inline bool tcp_paws_reject(const struct tcp_options_received *rx_opt,
|
|
|
|
|
|
However, we can relax time bounds for RST segments to MSL.
|
|
|
*/
|
|
|
- if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL)
|
|
|
+ if (rst && !time_before32(ktime_get_seconds(),
|
|
|
+ rx_opt->ts_recent_stamp + TCP_PAWS_MSL))
|
|
|
return false;
|
|
|
return true;
|
|
|
}
|