diff options
author | Shung-Hsi Yu <shung-hsi.yu@suse.com> | 2023-10-27 16:57:05 +0800 |
---|---|---|
committer | David Ahern <dsahern@kernel.org> | 2023-10-27 16:56:39 +0000 |
commit | 73284227f7a0078a05d4c9825f972039d80d7c93 (patch) | |
tree | 1bfdc422e6b739bf8dc3440fec90d9717f480bc0 | |
parent | ecea0c2a7bba5ed0911a5e10fa4008b2e173739a (diff) | |
download | iproute2-73284227f7a0078a05d4c9825f972039d80d7c93.tar.gz |
libbpf: set kernel_log_level when available
libbpf allows setting the log_level in struct bpf_object_open_opts
through the kernel_log_level field since v0.7, use it to set log level
to align with bpf_prog_load_dev() and bpf_btf_load().
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
-rw-r--r-- | lib/bpf_libbpf.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/bpf_libbpf.c b/lib/bpf_libbpf.c index e1c211a1b..4a8a20320 100644 --- a/lib/bpf_libbpf.c +++ b/lib/bpf_libbpf.c @@ -287,6 +287,10 @@ static int load_bpf_object(struct bpf_cfg_in *cfg) .pin_root_path = root_path, ); +#if (LIBBPF_MAJOR_VERSION > 0) || (LIBBPF_MINOR_VERSION >= 7) + open_opts.kernel_log_level = 1; +#endif + obj = bpf_object__open_file(cfg->object, &open_opts); if (libbpf_get_error(obj)) { fprintf(stderr, "ERROR: opening BPF object file failed\n"); |