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:

committed by
Alexei Starovoitov

parent
965112785e
commit
9349d600fb
@@ -1063,6 +1063,21 @@ static struct sock *tcp_v6_cookie_check(struct sock *sk, struct sk_buff *skb)
|
||||
return sk;
|
||||
}
|
||||
|
||||
u16 tcp_v6_get_syncookie(struct sock *sk, struct ipv6hdr *iph,
|
||||
struct tcphdr *th, u32 *cookie)
|
||||
{
|
||||
u16 mss = 0;
|
||||
#ifdef CONFIG_SYN_COOKIES
|
||||
mss = tcp_get_syncookie_mss(&tcp6_request_sock_ops,
|
||||
&tcp_request_sock_ipv6_ops, sk, th);
|
||||
if (mss) {
|
||||
*cookie = __cookie_v6_init_sequence(iph, th, &mss);
|
||||
tcp_synq_overflow(sk);
|
||||
}
|
||||
#endif
|
||||
return mss;
|
||||
}
|
||||
|
||||
static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
if (skb->protocol == htons(ETH_P_IP))
|
||||
|
Reference in New Issue
Block a user