summaryrefslogtreecommitdiffstats
path: root/tools/bpf/bpftool/iter.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2020-08-08 02:33:08 +0200
committerDavid S. Miller <davem@davemloft.net>2020-08-08 02:33:08 +0200
commit64cae2fb48ee10a84b044c516dba1b44d7f4d161 (patch)
treee04b6acd0324246149c14b4bc5c6817493b1869c /tools/bpf/bpftool/iter.c
parentmptcp: fix warn at shutdown time for unaccepted msk sockets (diff)
parentbpf: Delete repeated words in comments (diff)
downloadlinux-64cae2fb48ee10a84b044c516dba1b44d7f4d161.tar.xz
linux-64cae2fb48ee10a84b044c516dba1b44d7f4d161.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Daniel Borkmann says: ==================== pull-request: bpf 2020-08-08 The following pull-request contains BPF updates for your *net* tree. We've added 11 non-merge commits during the last 2 day(s) which contain a total of 24 files changed, 216 insertions(+), 135 deletions(-). The main changes are: 1) Fix UAPI for BPF map iterator before it gets frozen to allow for more extensions/customization in future, from Yonghong Song. 2) Fix selftests build to undo verbose build output, from Andrii Nakryiko. 3) Fix inlining compilation error on bpf_do_trace_printk() due to variable argument lists, from Stanislav Fomichev. 4) Fix an uninitialized pointer warning at btf__parse_raw() in libbpf, from Daniel T. Lee. 5) Fix several compilation warnings in selftests with regards to ignoring return value, from Jianlin Lv. 6) Fix interruptions by switching off timeout for BPF tests, from Jiri Benc. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/bpf/bpftool/iter.c')
-rw-r--r--tools/bpf/bpftool/iter.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/bpf/bpftool/iter.c b/tools/bpf/bpftool/iter.c
index c9dba7543dba..3b1aad7535dd 100644
--- a/tools/bpf/bpftool/iter.c
+++ b/tools/bpf/bpftool/iter.c
@@ -11,6 +11,7 @@
static int do_pin(int argc, char **argv)
{
DECLARE_LIBBPF_OPTS(bpf_iter_attach_opts, iter_opts);
+ union bpf_iter_link_info linfo;
const char *objfile, *path;
struct bpf_program *prog;
struct bpf_object *obj;
@@ -36,6 +37,11 @@ static int do_pin(int argc, char **argv)
map_fd = map_parse_fd(&argc, &argv);
if (map_fd < 0)
return -1;
+
+ memset(&linfo, 0, sizeof(linfo));
+ linfo.map.map_fd = map_fd;
+ iter_opts.link_info = &linfo;
+ iter_opts.link_info_len = sizeof(linfo);
}
}
@@ -57,9 +63,6 @@ static int do_pin(int argc, char **argv)
goto close_obj;
}
- if (map_fd >= 0)
- iter_opts.map_fd = map_fd;
-
link = bpf_program__attach_iter(prog, &iter_opts);
if (IS_ERR(link)) {
err = PTR_ERR(link);