diff options
author | Jakub Sitnicki <jakub@cloudflare.com> | 2020-05-31 10:28:36 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-06-01 15:21:02 -0700 |
commit | a3fd7ceee05431d2c51ed86c6cae015d236a51f0 (patch) | |
tree | 239fb6cb80a26ab38befd59faa7d4354d5eac190 /include/net/netns | |
parent | 171526f6fee84de0c39e2b7aa7e666ba0bbfd173 (diff) | |
download | linux-stable-a3fd7ceee05431d2c51ed86c6cae015d236a51f0.tar.gz linux-stable-a3fd7ceee05431d2c51ed86c6cae015d236a51f0.tar.bz2 linux-stable-a3fd7ceee05431d2c51ed86c6cae015d236a51f0.zip |
net: Introduce netns_bpf for BPF programs attached to netns
In order to:
(1) attach more than one BPF program type to netns, or
(2) support attaching BPF programs to netns with bpf_link, or
(3) support multi-prog attach points for netns
we will need to keep more state per netns than a single pointer like we
have now for BPF flow dissector program.
Prepare for the above by extracting netns_bpf that is part of struct net,
for storing all state related to BPF programs attached to netns.
Turn flow dissector callbacks for querying/attaching/detaching a program
into generic ones that operate on netns_bpf. Next patch will move the
generic callbacks into their own module.
This is similar to how it is organized for cgroup with cgroup_bpf.
Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Cc: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/bpf/20200531082846.2117903-3-jakub@cloudflare.com
Diffstat (limited to 'include/net/netns')
-rw-r--r-- | include/net/netns/bpf.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/net/netns/bpf.h b/include/net/netns/bpf.h new file mode 100644 index 000000000000..a858d1c5b166 --- /dev/null +++ b/include/net/netns/bpf.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * BPF programs attached to network namespace + */ + +#ifndef __NETNS_BPF_H__ +#define __NETNS_BPF_H__ + +#include <linux/bpf-netns.h> + +struct bpf_prog; + +struct netns_bpf { + struct bpf_prog __rcu *progs[MAX_NETNS_BPF_ATTACH_TYPE]; +}; + +#endif /* __NETNS_BPF_H__ */ |