Skip to content

Commit

Permalink
bpf/bpftool: handle libbpf_probe_prog_type errors
Browse files Browse the repository at this point in the history
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/20220202225916.3313522-3-andrii@kernel.org/

Signed-off-by: Milan Landaverde <milan@mdaverde.com>
  • Loading branch information
mdaverde authored and Nobody committed Mar 31, 2022
1 parent de0973e commit 2d36721
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/bpf/bpftool/feature.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ probe_prog_type(enum bpf_prog_type prog_type, bool *supported_types,

res = probe_prog_type_ifindex(prog_type, ifindex);
} else {
res = libbpf_probe_bpf_prog_type(prog_type, NULL);
res = libbpf_probe_bpf_prog_type(prog_type, NULL) > 0;
}

#ifdef USE_LIBCAP
Expand Down

0 comments on commit 2d36721

Please sign in to comment.