mirror of
https://github.com/torvalds/linux.git
synced 2024-12-04 01:51:34 +00:00
ab53cad90e
To support multi-prog link-based attachments for new netns attach types, we need to keep track of more than one bpf_link per attach type. Hence, convert net->bpf.links into a list, that currently can be either empty or have just one item. Instead of reusing bpf_prog_list from bpf-cgroup, we link together bpf_netns_link's themselves. This makes list management simpler as we don't have to allocate, initialize, and later release list elements. We can do this because multi-prog attachment will be available only for bpf_link, and we don't need to build a list of programs attached directly and indirectly via links. No functional changes intended. Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Link: https://lore.kernel.org/bpf/20200625141357.910330-4-jakub@cloudflare.com
22 lines
498 B
C
22 lines
498 B
C
/* 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 bpf_prog_array;
|
|
|
|
struct netns_bpf {
|
|
/* Array of programs to run compiled from progs or links */
|
|
struct bpf_prog_array __rcu *run_array[MAX_NETNS_BPF_ATTACH_TYPE];
|
|
struct bpf_prog *progs[MAX_NETNS_BPF_ATTACH_TYPE];
|
|
struct list_head links[MAX_NETNS_BPF_ATTACH_TYPE];
|
|
};
|
|
|
|
#endif /* __NETNS_BPF_H__ */
|