diff options
author | Martin KaFai Lau <kafai@fb.com> | 2020-04-24 11:29:11 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-04-24 17:40:54 -0700 |
commit | 32e4c6f4bc00366ede053ab6bb8109ec0fae0e54 (patch) | |
tree | c9eddcb2c995c15432af25402db356c90ac3d757 | |
parent | 1d8a0af5ee1ad219a9ebd9b43559b165bcb3ff40 (diff) | |
download | linux-32e4c6f4bc00366ede053ab6bb8109ec0fae0e54.tar.gz linux-32e4c6f4bc00366ede053ab6bb8109ec0fae0e54.tar.bz2 linux-32e4c6f4bc00366ede053ab6bb8109ec0fae0e54.zip |
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: 65c93628599d ("bpftool: Add struct_ops support")
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20200424182911.1259355-1-kafai@fb.com
-rw-r--r-- | tools/bpf/bpftool/struct_ops.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/struct_ops.c b/tools/bpf/bpftool/struct_ops.c index 0fe0d584c57e..e17738479edc 100644 --- a/tools/bpf/bpftool/struct_ops.c +++ b/tools/bpf/bpftool/struct_ops.c @@ -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); @@ -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; } |