#include <linux/bpf.h>
#include <linux/bpf-netns.h>
#include <linux/filter.h>
#include <net/net_namespace.h>
struct bpf_netns_link { … };
DEFINE_MUTEX(…) …;
static void netns_bpf_attach_type_unneed(enum netns_bpf_attach_type type)
{ … }
static void netns_bpf_attach_type_need(enum netns_bpf_attach_type type)
{ … }
static void netns_bpf_run_array_detach(struct net *net,
enum netns_bpf_attach_type type)
{ … }
static int link_index(struct net *net, enum netns_bpf_attach_type type,
struct bpf_netns_link *link)
{ … }
static int link_count(struct net *net, enum netns_bpf_attach_type type)
{ … }
static void fill_prog_array(struct net *net, enum netns_bpf_attach_type type,
struct bpf_prog_array *prog_array)
{ … }
static void bpf_netns_link_release(struct bpf_link *link)
{ … }
static int bpf_netns_link_detach(struct bpf_link *link)
{ … }
static void bpf_netns_link_dealloc(struct bpf_link *link)
{ … }
static int bpf_netns_link_update_prog(struct bpf_link *link,
struct bpf_prog *new_prog,
struct bpf_prog *old_prog)
{ … }
static int bpf_netns_link_fill_info(const struct bpf_link *link,
struct bpf_link_info *info)
{ … }
static void bpf_netns_link_show_fdinfo(const struct bpf_link *link,
struct seq_file *seq)
{ … }
static const struct bpf_link_ops bpf_netns_link_ops = …;
static int __netns_bpf_prog_query(const union bpf_attr *attr,
union bpf_attr __user *uattr,
struct net *net,
enum netns_bpf_attach_type type)
{ … }
int netns_bpf_prog_query(const union bpf_attr *attr,
union bpf_attr __user *uattr)
{ … }
int netns_bpf_prog_attach(const union bpf_attr *attr, struct bpf_prog *prog)
{ … }
static int __netns_bpf_prog_detach(struct net *net,
enum netns_bpf_attach_type type,
struct bpf_prog *old)
{ … }
int netns_bpf_prog_detach(const union bpf_attr *attr, enum bpf_prog_type ptype)
{ … }
static int netns_bpf_max_progs(enum netns_bpf_attach_type type)
{ … }
static int netns_bpf_link_attach(struct net *net, struct bpf_link *link,
enum netns_bpf_attach_type type)
{ … }
int netns_bpf_link_create(const union bpf_attr *attr, struct bpf_prog *prog)
{ … }
static int __net_init netns_bpf_pernet_init(struct net *net)
{ … }
static void __net_exit netns_bpf_pernet_pre_exit(struct net *net)
{ … }
static struct pernet_operations netns_bpf_pernet_ops __net_initdata = …;
static int __init netns_bpf_init(void)
{ … }
subsys_initcall(netns_bpf_init);