Andrii Nakryiko
b9f4c01f3e
selftest/bpf: Make bpf_iter selftest compilable against old vmlinux.h
...
It's good to be able to compile bpf_iter selftest even on systems that don't
have the very latest vmlinux.h, e.g., for libbpf tests against older kernels in
Travis CI. To that extent, re-define bpf_iter_meta and corresponding bpf_iter
context structs in each selftest. To avoid type clashes with vmlinux.h, rename
vmlinux.h's definitions to get them out of the way.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Link: https://lore.kernel.org/bpf/20200518234516.3915052-1-andriin@fb.com
2020-05-19 11:41:49 -07:00
Yonghong Song
7c128a6bbd
tools/bpf: selftests: Add iterator programs for ipv6_route and netlink
...
Two bpf programs are added in this patch for netlink and ipv6_route
target. On my VM, I am able to achieve identical
results compared to /proc/net/netlink and /proc/net/ipv6_route.
$ cat /proc/net/netlink
sk Eth Pid Groups Rmem Wmem Dump Locks Drops Inode
000000002c42d58b 0 0 00000000 0 0 0 2 0 7
00000000a4e8b5e1 0 1 00000551 0 0 0 2 0 18719
00000000e1b1c195 4 0 00000000 0 0 0 2 0 16422
000000007e6b29f9 6 0 00000000 0 0 0 2 0 16424
....
00000000159a170d 15 1862 00000002 0 0 0 2 0 1886
000000009aca4bc9 15 3918224839 00000002 0 0 0 2 0 19076
00000000d0ab31d2 15 1 00000002 0 0 0 2 0 18683
000000008398fb08 16 0 00000000 0 0 0 2 0 27
$ cat /sys/fs/bpf/my_netlink
sk Eth Pid Groups Rmem Wmem Dump Locks Drops Inode
000000002c42d58b 0 0 00000000 0 0 0 2 0 7
00000000a4e8b5e1 0 1 00000551 0 0 0 2 0 18719
00000000e1b1c195 4 0 00000000 0 0 0 2 0 16422
000000007e6b29f9 6 0 00000000 0 0 0 2 0 16424
....
00000000159a170d 15 1862 00000002 0 0 0 2 0 1886
000000009aca4bc9 15 3918224839 00000002 0 0 0 2 0 19076
00000000d0ab31d2 15 1 00000002 0 0 0 2 0 18683
000000008398fb08 16 0 00000000 0 0 0 2 0 27
$ cat /proc/net/ipv6_route
fe800000000000000000000000000000 40 00000000000000000000000000000000 00 00000000000000000000000000000000 00000100 00000001 00000000 00000001 eth0
00000000000000000000000000000000 00 00000000000000000000000000000000 00 00000000000000000000000000000000 ffffffff 00000001 00000000 00200200 lo
00000000000000000000000000000001 80 00000000000000000000000000000000 00 00000000000000000000000000000000 00000000 00000003 00000000 80200001 lo
fe80000000000000c04b03fffe7827ce 80 00000000000000000000000000000000 00 00000000000000000000000000000000 00000000 00000002 00000000 80200001 eth0
ff000000000000000000000000000000 08 00000000000000000000000000000000 00 00000000000000000000000000000000 00000100 00000003 00000000 00000001 eth0
00000000000000000000000000000000 00 00000000000000000000000000000000 00 00000000000000000000000000000000 ffffffff 00000001 00000000 00200200 lo
$ cat /sys/fs/bpf/my_ipv6_route
fe800000000000000000000000000000 40 00000000000000000000000000000000 00 00000000000000000000000000000000 00000100 00000001 00000000 00000001 eth0
00000000000000000000000000000000 00 00000000000000000000000000000000 00 00000000000000000000000000000000 ffffffff 00000001 00000000 00200200 lo
00000000000000000000000000000001 80 00000000000000000000000000000000 00 00000000000000000000000000000000 00000000 00000003 00000000 80200001 lo
fe80000000000000c04b03fffe7827ce 80 00000000000000000000000000000000 00 00000000000000000000000000000000 00000000 00000002 00000000 80200001 eth0
ff000000000000000000000000000000 08 00000000000000000000000000000000 00 00000000000000000000000000000000 00000100 00000003 00000000 00000001 eth0
00000000000000000000000000000000 00 00000000000000000000000000000000 00 00000000000000000000000000000000 ffffffff 00000001 00000000 00200200 lo
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200509175921.2477493-1-yhs@fb.com
2020-05-09 17:05:27 -07:00