diff options
author | Maxim Mikityanskiy <maximmi@nvidia.com> | 2022-06-15 16:48:46 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-06-17 07:20:30 +0300 |
commit | 9a4cf073866c414199be52bdac1afe6f72ecb8e1 (patch) | |
tree | 77f8cf9d5a7a4aaa82b255f3e199b1760b7d181e /net | |
parent | fb5cd0ce70d43b9bf589aa05aaa067350c3d3b26 (diff) | |
download | linux-9a4cf073866c414199be52bdac1afe6f72ecb8e1.tar.xz |
bpf: Allow the new syncookie helpers to work with SKBs
This commit allows the new BPF helpers to work in SKB context (in TC
BPF programs): bpf_tcp_raw_{gen,check}_syncookie_ipv{4,6}.
Using these helpers in TC BPF programs is not recommended, because it's
unlikely that the BPF program will provide any substantional speedup
compared to regular SYN cookies or synproxy, after the SKB is already
created.
Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://lore.kernel.org/r/20220615134847.3753567-6-maximmi@nvidia.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/filter.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/core/filter.c b/net/core/filter.c index b62d4126a561..423f47db84c6 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -7915,6 +7915,16 @@ tc_cls_act_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) return &bpf_sk_assign_proto; case BPF_FUNC_skb_set_tstamp: return &bpf_skb_set_tstamp_proto; +#ifdef CONFIG_SYN_COOKIES + case BPF_FUNC_tcp_raw_gen_syncookie_ipv4: + return &bpf_tcp_raw_gen_syncookie_ipv4_proto; + case BPF_FUNC_tcp_raw_gen_syncookie_ipv6: + return &bpf_tcp_raw_gen_syncookie_ipv6_proto; + case BPF_FUNC_tcp_raw_check_syncookie_ipv4: + return &bpf_tcp_raw_check_syncookie_ipv4_proto; + case BPF_FUNC_tcp_raw_check_syncookie_ipv6: + return &bpf_tcp_raw_check_syncookie_ipv6_proto; +#endif #endif default: return bpf_sk_base_func_proto(func_id); |