From: Paul Chaignon <paul@isovalent.com>
To: netdev@vger.kernel.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Hangbin Liu <haliu@redhat.com>, David Ahern <dsahern@gmail.com>
Subject: [PATCH iproute2] lib/bpf: fix verbose flag when using libbpf
Date: Thu, 16 Dec 2021 16:33:36 +0100 [thread overview]
Message-ID: <20211216153336.GA30454@Mem> (raw)
Since commit 6d61a2b55799 ("lib: add libbpf support"), passing the
verbose flag to tc filter doesn't dump the verifier logs anymore in case
of successful loading.
This commit fixes it by setting the log_level attribute before loading.
To that end, we need to call bpf_object__load_xattr directly instead of
relying on bpf_object__load.
Fixes: 6d61a2b55799 ("lib: add libbpf support")
Signed-off-by: Paul Chaignon <paul@isovalent.com>
---
lib/bpf_libbpf.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/bpf_libbpf.c b/lib/bpf_libbpf.c
index dbec2cb5..b992a62c 100644
--- a/lib/bpf_libbpf.c
+++ b/lib/bpf_libbpf.c
@@ -246,6 +246,7 @@ static int handle_legacy_maps(struct bpf_object *obj)
static int load_bpf_object(struct bpf_cfg_in *cfg)
{
+ struct bpf_object_load_attr attr = {};
struct bpf_program *p, *prog = NULL;
struct bpf_object *obj;
char root_path[PATH_MAX];
@@ -302,7 +303,11 @@ static int load_bpf_object(struct bpf_cfg_in *cfg)
if (ret)
goto unload_obj;
- ret = bpf_object__load(obj);
+ attr.obj = obj;
+ if (cfg->verbose) {
+ attr.log_level = 2;
+ }
+ ret = bpf_object__load_xattr(&attr);
if (ret)
goto unload_obj;
--
2.25.1
next reply other threads:[~2021-12-16 15:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-16 15:33 Paul Chaignon [this message]
2021-12-17 7:15 ` [PATCH iproute2] lib/bpf: fix verbose flag when using libbpf Hangbin Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211216153336.GA30454@Mem \
--to=paul@isovalent.com \
--cc=dsahern@gmail.com \
--cc=haliu@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.