diff options
author | Daniel T. Lee <danieltimlee@gmail.com> | 2020-11-24 09:03:05 +0000 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2020-11-26 19:33:35 -0800 |
commit | d89af13c92056c46dfc4bcb3d90efe88937c3381 (patch) | |
tree | c4563673da85cde8dde280a53c94fae4591c8fde /samples/connector | |
parent | c5815ac7e2aaff4f00b2b9e21d84b9f2fddddb48 (diff) |
samples: bpf: Refactor test_cgrp2_sock2 program with libbpf
This commit refactors the existing cgroup program with libbpf bpf
loader. The original test_cgrp2_sock2 has keeped the bpf program
attached to the cgroup hierarchy even after the exit of user program.
To implement the same functionality with libbpf, this commit uses the
BPF_LINK_PINNING to pin the link attachment even after it is closed.
Since this uses LINK instead of ATTACH, detach of bpf program from
cgroup with 'test_cgrp2_sock' is not used anymore.
The code to mount the bpf was added to the .sh file in case the bpff
was not mounted on /sys/fs/bpf. Additionally, to fix the problem that
shell script cannot find the binary object from the current path,
relative path './' has been added in front of binary.
Fixes: 554ae6e792ef3 ("samples/bpf: add userspace example for prohibiting sockets")
Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20201124090310.24374-3-danieltimlee@gmail.com
Diffstat (limited to 'samples/connector')
0 files changed, 0 insertions, 0 deletions