mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
net/tcp-fastopen: refactor cookie check logic
Refactor the cookie check logic in tcp_send_syn_data() into a function. This function will be called else where in later changes. Signed-off-by: Wei Wang <weiwan@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Acked-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a9c54ad2c7
commit
065263f40f
3 changed files with 25 additions and 14 deletions
|
@ -325,3 +325,24 @@ fastopen:
|
|||
*foc = valid_foc;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool tcp_fastopen_cookie_check(struct sock *sk, u16 *mss,
|
||||
struct tcp_fastopen_cookie *cookie)
|
||||
{
|
||||
unsigned long last_syn_loss = 0;
|
||||
int syn_loss = 0;
|
||||
|
||||
tcp_fastopen_cache_get(sk, mss, cookie, &syn_loss, &last_syn_loss);
|
||||
|
||||
/* Recurring FO SYN losses: no cookie or data in SYN */
|
||||
if (syn_loss > 1 &&
|
||||
time_before(jiffies, last_syn_loss + (60*HZ << syn_loss))) {
|
||||
cookie->len = -1;
|
||||
return false;
|
||||
}
|
||||
if (sysctl_tcp_fastopen & TFO_CLIENT_NO_COOKIE) {
|
||||
cookie->len = -1;
|
||||
return true;
|
||||
}
|
||||
return cookie->len > 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue