mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 09:31:14 +00:00
tcp: add skb-less helpers to retrieve SYN cookie
This patch allows generation of a SYN cookie before an SKB has been allocated, as is the case at XDP. Signed-off-by: Petar Penkov <ppenkov@google.com> Reviewed-by: Lorenz Bauer <lmb@cloudflare.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
965112785e
commit
9349d600fb
4 changed files with 113 additions and 0 deletions
|
@ -1515,6 +1515,21 @@ static struct sock *tcp_v4_cookie_check(struct sock *sk, struct sk_buff *skb)
|
|||
return sk;
|
||||
}
|
||||
|
||||
u16 tcp_v4_get_syncookie(struct sock *sk, struct iphdr *iph,
|
||||
struct tcphdr *th, u32 *cookie)
|
||||
{
|
||||
u16 mss = 0;
|
||||
#ifdef CONFIG_SYN_COOKIES
|
||||
mss = tcp_get_syncookie_mss(&tcp_request_sock_ops,
|
||||
&tcp_request_sock_ipv4_ops, sk, th);
|
||||
if (mss) {
|
||||
*cookie = __cookie_v4_init_sequence(iph, th, &mss);
|
||||
tcp_synq_overflow(sk);
|
||||
}
|
||||
#endif
|
||||
return mss;
|
||||
}
|
||||
|
||||
/* The socket must have it's spinlock held when we get
|
||||
* here, unless it is a TCP_LISTEN socket.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue