-
- Downloads
bpf: Add BPF_CGROUP_INET_SOCK_RELEASE hook
Sometimes it's handy to know when the socket gets freed. In particular, we'd like to try to use a smarter allocation of ports for bpf_bind and explore the possibility of limiting the number of SOCK_DGRAM sockets the process can have. Implement BPF_CGROUP_INET_SOCK_RELEASE hook that triggers on inet socket release. It triggers only for userspace sockets (not in-kernel ones) and therefore has the same semantics as the existing BPF_CGROUP_INET_SOCK_CREATE. Signed-off-by:Stanislav Fomichev <sdf@google.com> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net> Acked-by:
Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/20200706230128.4073544-2-sdf@google.com
Showing
- include/linux/bpf-cgroup.h 4 additions, 0 deletionsinclude/linux/bpf-cgroup.h
- include/uapi/linux/bpf.h 1 addition, 0 deletionsinclude/uapi/linux/bpf.h
- kernel/bpf/syscall.c 3 additions, 0 deletionskernel/bpf/syscall.c
- net/core/filter.c 1 addition, 0 deletionsnet/core/filter.c
- net/ipv4/af_inet.c 3 additions, 0 deletionsnet/ipv4/af_inet.c
Loading
Please register or sign in to comment