mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
bpftool: Stop supporting BPF offload-enabled feature probing
libbpf 1.0 is not going to support passing ifindex to BPF prog/map/helper feature probing APIs. Remove the support for BPF offload feature probing. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Quentin Monnet <quentin@isovalent.com> Link: https://lore.kernel.org/bpf/20220202225916.3313522-3-andrii@kernel.org
This commit is contained in:
parent
a5dd9589f0
commit
1a56c18e6c
1 changed files with 17 additions and 12 deletions
|
@ -487,17 +487,12 @@ probe_prog_type(enum bpf_prog_type prog_type, bool *supported_types,
|
||||||
size_t maxlen;
|
size_t maxlen;
|
||||||
bool res;
|
bool res;
|
||||||
|
|
||||||
if (ifindex)
|
if (ifindex) {
|
||||||
/* Only test offload-able program types */
|
p_info("BPF offload feature probing is not supported");
|
||||||
switch (prog_type) {
|
return;
|
||||||
case BPF_PROG_TYPE_SCHED_CLS:
|
}
|
||||||
case BPF_PROG_TYPE_XDP:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = bpf_probe_prog_type(prog_type, ifindex);
|
res = libbpf_probe_bpf_prog_type(prog_type, NULL);
|
||||||
#ifdef USE_LIBCAP
|
#ifdef USE_LIBCAP
|
||||||
/* Probe may succeed even if program load fails, for unprivileged users
|
/* Probe may succeed even if program load fails, for unprivileged users
|
||||||
* check that we did not fail because of insufficient permissions
|
* check that we did not fail because of insufficient permissions
|
||||||
|
@ -535,7 +530,12 @@ probe_map_type(enum bpf_map_type map_type, const char *define_prefix,
|
||||||
size_t maxlen;
|
size_t maxlen;
|
||||||
bool res;
|
bool res;
|
||||||
|
|
||||||
res = bpf_probe_map_type(map_type, ifindex);
|
if (ifindex) {
|
||||||
|
p_info("BPF offload feature probing is not supported");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = libbpf_probe_bpf_map_type(map_type, NULL);
|
||||||
|
|
||||||
/* Probe result depends on the success of map creation, no additional
|
/* Probe result depends on the success of map creation, no additional
|
||||||
* check required for unprivileged users
|
* check required for unprivileged users
|
||||||
|
@ -567,7 +567,12 @@ probe_helper_for_progtype(enum bpf_prog_type prog_type, bool supported_type,
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
||||||
if (supported_type) {
|
if (supported_type) {
|
||||||
res = bpf_probe_helper(id, prog_type, ifindex);
|
if (ifindex) {
|
||||||
|
p_info("BPF offload feature probing is not supported");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = libbpf_probe_bpf_helper(prog_type, id, NULL);
|
||||||
#ifdef USE_LIBCAP
|
#ifdef USE_LIBCAP
|
||||||
/* Probe may succeed even if program load fails, for
|
/* Probe may succeed even if program load fails, for
|
||||||
* unprivileged users check that we did not fail because of
|
* unprivileged users check that we did not fail because of
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue