]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
libbpf: set kernel_log_level when available
authorShung-Hsi Yu <shung-hsi.yu@suse.com>
Fri, 27 Oct 2023 08:57:05 +0000 (16:57 +0800)
committerDavid Ahern <dsahern@kernel.org>
Fri, 27 Oct 2023 16:56:39 +0000 (16:56 +0000)
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>
lib/bpf_libbpf.c

index e1c211a1b3b722b64c307d87bf3205dba34555cc..4a8a2032075c976c23f409beeba99eb5e2fd684a 100644 (file)
@@ -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");