diff options
author | Jörn-Thorben Hinz <jthinz@mailbox.tu-berlin.de> | 2022-06-22 21:12:27 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-06-23 09:49:58 -0700 |
commit | f14a3f644a1c5a2e2dbe6073f51793119a12e6ce (patch) | |
tree | 2f2467f86f8349cf645ce153714272a6770c3f7b /tools/testing/selftests/bpf/progs/tcp_ca_unsupp_cong_op.c | |
parent | 0735627d78caa56f219dc14608ce0bdbd045e07e (diff) | |
download | linux-f14a3f644a1c5a2e2dbe6073f51793119a12e6ce.tar.gz linux-f14a3f644a1c5a2e2dbe6073f51793119a12e6ce.tar.bz2 linux-f14a3f644a1c5a2e2dbe6073f51793119a12e6ce.zip |
selftests/bpf: Test a BPF CC implementing the unsupported get_info()
Test whether a TCP CC implemented in BPF providing get_info() is
rejected correctly. get_info() is unsupported in a BPF CC. The check for
required functions in a BPF CC has moved, this test ensures unsupported
functions are still rejected correctly.
Signed-off-by: Jörn-Thorben Hinz <jthinz@mailbox.tu-berlin.de>
Reviewed-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/r/20220622191227.898118-6-jthinz@mailbox.tu-berlin.de
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/tcp_ca_unsupp_cong_op.c')
-rw-r--r-- | tools/testing/selftests/bpf/progs/tcp_ca_unsupp_cong_op.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/tcp_ca_unsupp_cong_op.c b/tools/testing/selftests/bpf/progs/tcp_ca_unsupp_cong_op.c new file mode 100644 index 000000000000..c06f4a41c21a --- /dev/null +++ b/tools/testing/selftests/bpf/progs/tcp_ca_unsupp_cong_op.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include "vmlinux.h" + +#include <bpf/bpf_helpers.h> +#include <bpf/bpf_tracing.h> + +char _license[] SEC("license") = "GPL"; + +SEC("struct_ops/unsupp_cong_op_get_info") +size_t BPF_PROG(unsupp_cong_op_get_info, struct sock *sk, u32 ext, int *attr, + union tcp_cc_info *info) +{ + return 0; +} + +SEC(".struct_ops") +struct tcp_congestion_ops unsupp_cong_op = { + .get_info = (void *)unsupp_cong_op_get_info, + .name = "bpf_unsupp_op", +}; |