summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKP Singh <kpsingh@kernel.org>2022-05-09 21:49:05 +0000
committerAlexei Starovoitov <ast@kernel.org>2022-05-10 10:42:08 -0700
commitbd2331b3757f5b2ab4aafc591b55fa2a592abf7c (patch)
tree48dde41cb00f9f949fbc4647c7b25285631c7e09
parenta82ebb093fc7bdd88f8df17b2fa303d7535fa43b (diff)
bpftool: bpf_link_get_from_fd support for LSM programs in lskel
bpf_link_get_from_fd currently returns a NULL fd for LSM programs. LSM programs are similar to tracing programs and can also use skel_raw_tracepoint_open. Signed-off-by: KP Singh <kpsingh@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20220509214905.3754984-1-kpsingh@kernel.org
-rw-r--r--tools/bpf/bpftool/gen.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
index aa1dc8fdcf4e..4c9477ff748d 100644
--- a/tools/bpf/bpftool/gen.c
+++ b/tools/bpf/bpftool/gen.c
@@ -549,6 +549,7 @@ static void codegen_attach_detach(struct bpf_object *obj, const char *obj_name)
printf("\tint fd = skel_raw_tracepoint_open(\"%s\", prog_fd);\n", tp_name);
break;
case BPF_PROG_TYPE_TRACING:
+ case BPF_PROG_TYPE_LSM:
if (bpf_program__expected_attach_type(prog) == BPF_TRACE_ITER)
printf("\tint fd = skel_link_create(prog_fd, 0, BPF_TRACE_ITER);\n");
else