Skip to content

Commit 7b53eaa

Browse files
mdaverdeanakryiko
authored andcommitted
bpftool: Handle libbpf_probe_prog_type errors
Previously [1], we were using bpf_probe_prog_type which returned a bool, but the new libbpf_probe_bpf_prog_type can return a negative error code on failure. This change decides for bpftool to declare a program type is not available on probe failure. [1] https://lore.kernel.org/bpf/[email protected]/ Signed-off-by: Milan Landaverde <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Reviewed-by: Quentin Monnet <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent fff3dfa commit 7b53eaa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/bpf/bpftool/feature.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ probe_prog_type(enum bpf_prog_type prog_type, bool *supported_types,
567567

568568
res = probe_prog_type_ifindex(prog_type, ifindex);
569569
} else {
570-
res = libbpf_probe_bpf_prog_type(prog_type, NULL);
570+
res = libbpf_probe_bpf_prog_type(prog_type, NULL) > 0;
571571
}
572572

573573
#ifdef USE_LIBCAP

0 commit comments

Comments
 (0)