#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/gfp.h>
#include <linux/if_arp.h>
#include <net/net_namespace.h>
#include <net/netlink.h>
#include <net/dst.h>
#include <net/pkt_sched.h>
#include <net/pkt_cls.h>
#include <linux/tc_act/tc_mirred.h>
#include <net/tc_act/tc_mirred.h>
#include <net/tc_wrapper.h>
static LIST_HEAD(mirred_list);
static DEFINE_SPINLOCK(mirred_list_lock);
#define MIRRED_NEST_LIMIT …
static DEFINE_PER_CPU(unsigned int, mirred_nest_level);
static bool tcf_mirred_is_act_redirect(int action)
{ … }
static bool tcf_mirred_act_wants_ingress(int action)
{ … }
static bool tcf_mirred_can_reinsert(int action)
{ … }
static struct net_device *tcf_mirred_dev_dereference(struct tcf_mirred *m)
{ … }
static void tcf_mirred_release(struct tc_action *a)
{ … }
static const struct nla_policy mirred_policy[TCA_MIRRED_MAX + 1] = …;
static struct tc_action_ops act_mirred_ops;
static void tcf_mirred_replace_dev(struct tcf_mirred *m,
struct net_device *ndev)
{ … }
static int tcf_mirred_init(struct net *net, struct nlattr *nla,
struct nlattr *est, struct tc_action **a,
struct tcf_proto *tp,
u32 flags, struct netlink_ext_ack *extack)
{ … }
static int
tcf_mirred_forward(bool at_ingress, bool want_ingress, struct sk_buff *skb)
{ … }
static int tcf_mirred_to_dev(struct sk_buff *skb, struct tcf_mirred *m,
struct net_device *dev,
const bool m_mac_header_xmit, int m_eaction,
int retval)
{ … }
static int tcf_blockcast_redir(struct sk_buff *skb, struct tcf_mirred *m,
struct tcf_block *block, int m_eaction,
const u32 exception_ifindex, int retval)
{ … }
static int tcf_blockcast_mirror(struct sk_buff *skb, struct tcf_mirred *m,
struct tcf_block *block, int m_eaction,
const u32 exception_ifindex, int retval)
{ … }
static int tcf_blockcast(struct sk_buff *skb, struct tcf_mirred *m,
const u32 blockid, struct tcf_result *res,
int retval)
{ … }
TC_INDIRECT_SCOPE int tcf_mirred_act(struct sk_buff *skb,
const struct tc_action *a,
struct tcf_result *res)
{ … }
static void tcf_stats_update(struct tc_action *a, u64 bytes, u64 packets,
u64 drops, u64 lastuse, bool hw)
{ … }
static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind,
int ref)
{ … }
static int mirred_device_event(struct notifier_block *unused,
unsigned long event, void *ptr)
{ … }
static struct notifier_block mirred_device_notifier = …;
static void tcf_mirred_dev_put(void *priv)
{ … }
static struct net_device *
tcf_mirred_get_dev(const struct tc_action *a,
tc_action_priv_destructor *destructor)
{ … }
static size_t tcf_mirred_get_fill_size(const struct tc_action *act)
{ … }
static void tcf_offload_mirred_get_dev(struct flow_action_entry *entry,
const struct tc_action *act)
{ … }
static int tcf_mirred_offload_act_setup(struct tc_action *act, void *entry_data,
u32 *index_inc, bool bind,
struct netlink_ext_ack *extack)
{ … }
static struct tc_action_ops act_mirred_ops = …;
MODULE_ALIAS_NET_ACT(…) …;
static __net_init int mirred_init_net(struct net *net)
{ … }
static void __net_exit mirred_exit_net(struct list_head *net_list)
{ … }
static struct pernet_operations mirred_net_ops = …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static int __init mirred_init_module(void)
{ … }
static void __exit mirred_cleanup_module(void)
{ … }
module_init(…) …;
module_exit(mirred_cleanup_module);