Skip to content

Commit 32e4c6f

Browse files
iamkafaiAlexei Starovoitov
authored andcommitted
bpftool: Respect the -d option in struct_ops cmd
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]
1 parent 1d8a0af commit 32e4c6f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/bpf/bpftool/struct_ops.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ static int do_unregister(int argc, char **argv)
479479

480480
static int do_register(int argc, char **argv)
481481
{
482+
struct bpf_object_load_attr load_attr = {};
482483
const struct bpf_map_def *def;
483484
struct bpf_map_info info = {};
484485
__u32 info_len = sizeof(info);
@@ -499,7 +500,12 @@ static int do_register(int argc, char **argv)
499500

500501
set_max_rlimit();
501502

502-
if (bpf_object__load(obj)) {
503+
load_attr.obj = obj;
504+
if (verifier_logs)
505+
/* log_level1 + log_level2 + stats, but not stable UAPI */
506+
load_attr.log_level = 1 + 2 + 4;
507+
508+
if (bpf_object__load_xattr(&load_attr)) {
503509
bpf_object__close(obj);
504510
return -1;
505511
}

0 commit comments

Comments
 (0)