Skip to content

Commit

Permalink
bpftool: Respect the -d option in struct_ops cmd
Browse files Browse the repository at this point in the history
In the prog cmd, the "-d" option turns on the verifier log.
This is missed in the "struct_ops" cmd and this patch fixes it.

Fixes: 65c9362 ("bpftool: Add struct_ops support")
Signed-off-by: Martin KaFai Lau <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Reviewed-by: Quentin Monnet <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
iamkafai authored and Alexei Starovoitov committed Apr 25, 2020
1 parent 1d8a0af commit 32e4c6f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/bpf/bpftool/struct_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ static int do_unregister(int argc, char **argv)

static int do_register(int argc, char **argv)
{
struct bpf_object_load_attr load_attr = {};
const struct bpf_map_def *def;
struct bpf_map_info info = {};
__u32 info_len = sizeof(info);
Expand All @@ -499,7 +500,12 @@ static int do_register(int argc, char **argv)

set_max_rlimit();

if (bpf_object__load(obj)) {
load_attr.obj = obj;
if (verifier_logs)
/* log_level1 + log_level2 + stats, but not stable UAPI */
load_attr.log_level = 1 + 2 + 4;

if (bpf_object__load_xattr(&load_attr)) {
bpf_object__close(obj);
return -1;
}
Expand Down

0 comments on commit 32e4c6f

Please sign in to comment.