@@ -2431,6 +2431,38 @@ union bpf_attr {
24312431 * Return
24322432 * A **struct bpf_sock** pointer on success, or **NULL** in
24332433 * case of failure.
2434+ *
2435+ * struct bpf_sock *bpf_skc_lookup_tcp(void *ctx, struct bpf_sock_tuple *tuple, u32 tuple_size, u64 netns, u64 flags)
2436+ * Description
2437+ * Look for TCP socket matching *tuple*, optionally in a child
2438+ * network namespace *netns*. The return value must be checked,
2439+ * and if non-**NULL**, released via **bpf_sk_release**\ ().
2440+ *
2441+ * This function is identical to bpf_sk_lookup_tcp, except that it
2442+ * also returns timewait or request sockets. Use bpf_sk_fullsock
2443+ * or bpf_tcp_socket to access the full structure.
2444+ *
2445+ * This helper is available only if the kernel was compiled with
2446+ * **CONFIG_NET** configuration option.
2447+ * Return
2448+ * Pointer to **struct bpf_sock**, or **NULL** in case of failure.
2449+ * For sockets with reuseport option, the **struct bpf_sock**
2450+ * result is from **reuse->socks**\ [] using the hash of the tuple.
2451+ *
2452+ * int bpf_tcp_check_syncookie(struct bpf_sock *sk, void *iph, u32 iph_len, struct tcphdr *th, u32 th_len)
2453+ * Description
2454+ * Check whether iph and th contain a valid SYN cookie ACK for
2455+ * the listening socket in sk.
2456+ *
2457+ * iph points to the start of the IPv4 or IPv6 header, while
2458+ * iph_len contains sizeof(struct iphdr) or sizeof(struct ip6hdr).
2459+ *
2460+ * th points to the start of the TCP header, while th_len contains
2461+ * sizeof(struct tcphdr).
2462+ *
2463+ * Return
2464+ * 0 if iph and th are a valid SYN cookie ACK, or a negative error
2465+ * otherwise.
24342466 */
24352467#define __BPF_FUNC_MAPPER (FN ) \
24362468 FN(unspec), \
@@ -2531,7 +2563,9 @@ union bpf_attr {
25312563 FN(sk_fullsock), \
25322564 FN(tcp_sock), \
25332565 FN(skb_ecn_set_ce), \
2534- FN(get_listener_sock),
2566+ FN(get_listener_sock), \
2567+ FN(skc_lookup_tcp), \
2568+ FN(tcp_check_syncookie),
25352569
25362570/* integer value in 'imm' field of BPF_CALL instruction selects which helper
25372571 * function eBPF program intends to call
0 commit comments