#include <linux/netdevice.h>
#include <linux/ethtool.h>
#include <linux/etherdevice.h>
#include <linux/filter.h>
#include <linux/netfilter_netdev.h>
#include <linux/bpf_mprog.h>
#include <linux/indirect_call_wrapper.h>
#include <net/netkit.h>
#include <net/dst.h>
#include <net/tcx.h>
#define DRV_NAME …
struct netkit { … };
struct netkit_link { … };
static __always_inline int
netkit_run(const struct bpf_mprog_entry *entry, struct sk_buff *skb,
enum netkit_action ret)
{ … }
static void netkit_prep_forward(struct sk_buff *skb, bool xnet)
{ … }
static struct netkit *netkit_priv(const struct net_device *dev)
{ … }
static netdev_tx_t netkit_xmit(struct sk_buff *skb, struct net_device *dev)
{ … }
static int netkit_open(struct net_device *dev)
{ … }
static int netkit_close(struct net_device *dev)
{ … }
static int netkit_get_iflink(const struct net_device *dev)
{ … }
static void netkit_set_multicast(struct net_device *dev)
{ … }
static int netkit_set_macaddr(struct net_device *dev, void *sa)
{ … }
static void netkit_set_headroom(struct net_device *dev, int headroom)
{ … }
INDIRECT_CALLABLE_SCOPE struct net_device *netkit_peer_dev(struct net_device *dev)
{ … }
static void netkit_get_stats(struct net_device *dev,
struct rtnl_link_stats64 *stats)
{ … }
static void netkit_uninit(struct net_device *dev);
static const struct net_device_ops netkit_netdev_ops = …;
static void netkit_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{ … }
static const struct ethtool_ops netkit_ethtool_ops = …;
static void netkit_setup(struct net_device *dev)
{ … }
static struct net *netkit_get_link_net(const struct net_device *dev)
{ … }
static int netkit_check_policy(int policy, struct nlattr *tb,
struct netlink_ext_ack *extack)
{ … }
static int netkit_check_mode(int mode, struct nlattr *tb,
struct netlink_ext_ack *extack)
{ … }
static int netkit_validate(struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static struct rtnl_link_ops netkit_link_ops;
static int netkit_new_link(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static struct bpf_mprog_entry *netkit_entry_fetch(struct net_device *dev,
bool bundle_fallback)
{ … }
static void netkit_entry_update(struct net_device *dev,
struct bpf_mprog_entry *entry)
{ … }
static void netkit_entry_sync(void)
{ … }
static struct net_device *netkit_dev_fetch(struct net *net, u32 ifindex, u32 which)
{ … }
int netkit_prog_attach(const union bpf_attr *attr, struct bpf_prog *prog)
{ … }
int netkit_prog_detach(const union bpf_attr *attr, struct bpf_prog *prog)
{ … }
int netkit_prog_query(const union bpf_attr *attr, union bpf_attr __user *uattr)
{ … }
static struct netkit_link *netkit_link(const struct bpf_link *link)
{ … }
static int netkit_link_prog_attach(struct bpf_link *link, u32 flags,
u32 id_or_fd, u64 revision)
{ … }
static void netkit_link_release(struct bpf_link *link)
{ … }
static int netkit_link_update(struct bpf_link *link, struct bpf_prog *nprog,
struct bpf_prog *oprog)
{ … }
static void netkit_link_dealloc(struct bpf_link *link)
{ … }
static void netkit_link_fdinfo(const struct bpf_link *link, struct seq_file *seq)
{ … }
static int netkit_link_fill_info(const struct bpf_link *link,
struct bpf_link_info *info)
{ … }
static int netkit_link_detach(struct bpf_link *link)
{ … }
static const struct bpf_link_ops netkit_link_lops = …;
static int netkit_link_init(struct netkit_link *nkl,
struct bpf_link_primer *link_primer,
const union bpf_attr *attr,
struct net_device *dev,
struct bpf_prog *prog)
{ … }
int netkit_link_attach(const union bpf_attr *attr, struct bpf_prog *prog)
{ … }
static void netkit_release_all(struct net_device *dev)
{ … }
static void netkit_uninit(struct net_device *dev)
{ … }
static void netkit_del_link(struct net_device *dev, struct list_head *head)
{ … }
static int netkit_change_link(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static size_t netkit_get_size(const struct net_device *dev)
{ … }
static int netkit_fill_info(struct sk_buff *skb, const struct net_device *dev)
{ … }
static const struct nla_policy netkit_policy[IFLA_NETKIT_MAX + 1] = …;
static struct rtnl_link_ops netkit_link_ops = …;
static __init int netkit_init(void)
{ … }
static __exit void netkit_exit(void)
{ … }
module_init(…) …;
module_exit(netkit_exit);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS_RTNL_LINK(…);