add bpf cgroup hooks that trigger on socket close
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest5 patches 8 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | bpf: add BPF_CGROUP_INET{4,6}_SOCK_RELEASE hooksinclude/ include/ include/ +4 more | +40 | 1 reply | |
| 2/5 | tools: bpf: support BPF_CGROUP_INET{4,6}_SOCK_RELEASE in libbpf/bpftooltools/ tools/ tools/ | +8 | 0 replies | |
| 3/5 | selftests/bpf: add BPF_CGROUP_INET{4,6}_SOCK_RELEASE to test_section_names.ctools/ | +10 | 0 replies | |
| 4/5 | selftests/bpf: add BPF_CGROUP_INET{4,6}_SOCK_RELEASE to test_sock.ctools/ | +119 | 0 replies | |
| 5/5 | selftests/bpf: add BPF_CGROUP_INET{4,6}_SOCK_RELEASE to test_sock_addr.ctools/ | +130 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH bpf-next 0/5] add bpf cgroup hooks that trigger on socket close
Currently, we have BPF_CGROUP_INET_SOCK_CREATE hook that triggers on socket creation and there is no way to know when the socket is being closed. Add new set of hooks BPF_CGROUP_INET{4,6}_SOCK_RELEASE that trigger when the socket is closed.
Initial intended usecase is to cleanup statistics after POST{4,6}_BIND. Hooks have read-only access to all fields of struct bpf_sock.
First patch adds hooks, the rest of the patches add uapi and tests to make sure these hooks work.
Stanislav Fomichev (5):
bpf: add BPF_CGROUP_INET{4,6}_SOCK_RELEASE hooks
tools: bpf: support BPF_CGROUP_INET{4,6}_SOCK_RELEASE in
libbpf/bpftool
selftests/bpf: add BPF_CGROUP_INET{4,6}_SOCK_RELEASE to
test_section_names.c
selftests/bpf: add BPF_CGROUP_INET{4,6}_SOCK_RELEASE to test_sock.c selftests/bpf: add BPF_CGROUP_INET{4,6}_SOCK_RELEASE to
test_sock_addr.c
include/linux/bpf-cgroup.h | 6 + include/net/inet_common.h | 1 + include/uapi/linux/bpf.h | 2 + kernel/bpf/syscall.c | 8 ++ net/core/filter.c | 7 + net/ipv4/af_inet.c | 13 +- net/ipv6/af_inet6.c | 5 +- tools/bpf/bpftool/cgroup.c | 2 + tools/include/uapi/linux/bpf.h | 2 + tools/lib/bpf/libbpf.c | 4 + .../selftests/bpf/test_section_names.c | 10 ++ tools/testing/selftests/bpf/test_sock.c | 119 ++++++++++++++++ tools/testing/selftests/bpf/test_sock_addr.c | 131 +++++++++++++++++- 13 files changed, 307 insertions(+), 3 deletions(-)
Signature · 1 line
2.20.1.321.g9e740568ce-goog