aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/uapi
diff options
context:
space:
mode:
authorStanislav Fomichev <sdf@google.com>2020-07-06 16:01:25 -0700
committerDaniel Borkmann <daniel@iogearbox.net>2020-07-08 01:03:31 +0200
commitf5836749c9c04a10decd2742845ad4870965fdef (patch)
tree44335764c2ebba2099ba8bf26267bdfac7c36ed1 /include/uapi
parentmvpp2: fix pointer check (diff)
downloadwireguard-linux-f5836749c9c04a10decd2742845ad4870965fdef.tar.xz
wireguard-linux-f5836749c9c04a10decd2742845ad4870965fdef.zip
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
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/bpf.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index da9bf35a26f8..548a749aebb3 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -226,6 +226,7 @@ enum bpf_attach_type {
BPF_CGROUP_INET4_GETSOCKNAME,
BPF_CGROUP_INET6_GETSOCKNAME,
BPF_XDP_DEVMAP,
+ BPF_CGROUP_INET_SOCK_RELEASE,
__MAX_BPF_ATTACH_TYPE
};