Commit 32e4c6f4 authored by Martin KaFai Lau's avatar Martin KaFai Lau Committed by Alexei Starovoitov

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: 65c93628 ("bpftool: Add struct_ops support")
Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Reviewed-by: default avatarQuentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20200424182911.1259355-1-kafai@fb.com
parent 1d8a0af5
...@@ -479,6 +479,7 @@ static int do_unregister(int argc, char **argv) ...@@ -479,6 +479,7 @@ static int do_unregister(int argc, char **argv)
static int do_register(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; const struct bpf_map_def *def;
struct bpf_map_info info = {}; struct bpf_map_info info = {};
__u32 info_len = sizeof(info); __u32 info_len = sizeof(info);
...@@ -499,7 +500,12 @@ static int do_register(int argc, char **argv) ...@@ -499,7 +500,12 @@ static int do_register(int argc, char **argv)
set_max_rlimit(); 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); bpf_object__close(obj);
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment