#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/module.h>
#include <linux/timekeeping.h>
#include <net/net_namespace.h>
#include <net/sock.h>
#include <net/netlink.h>
#include <net/genetlink.h>
#include <net/psample.h>
#include <linux/spinlock.h>
#include <net/ip_tunnels.h>
#include <net/dst_metadata.h>
#define PSAMPLE_MAX_PACKET_SIZE …
static LIST_HEAD(psample_groups_list);
static DEFINE_SPINLOCK(psample_groups_lock);
enum psample_nl_multicast_groups { … };
static const struct genl_multicast_group psample_nl_mcgrps[] = …;
static struct genl_family psample_nl_family __ro_after_init;
static int psample_group_nl_fill(struct sk_buff *msg,
struct psample_group *group,
enum psample_command cmd, u32 portid, u32 seq,
int flags)
{ … }
static int psample_nl_cmd_get_group_dumpit(struct sk_buff *msg,
struct netlink_callback *cb)
{ … }
static const struct genl_small_ops psample_nl_ops[] = …;
static struct genl_family psample_nl_family __ro_after_init = …;
static void psample_group_notify(struct psample_group *group,
enum psample_command cmd)
{ … }
static struct psample_group *psample_group_create(struct net *net,
u32 group_num)
{ … }
static void psample_group_destroy(struct psample_group *group)
{ … }
static struct psample_group *
psample_group_lookup(struct net *net, u32 group_num)
{ … }
struct psample_group *psample_group_get(struct net *net, u32 group_num)
{ … }
EXPORT_SYMBOL_GPL(…);
void psample_group_take(struct psample_group *group)
{ … }
EXPORT_SYMBOL_GPL(…);
void psample_group_put(struct psample_group *group)
{ … }
EXPORT_SYMBOL_GPL(…);
#ifdef CONFIG_INET
static int __psample_ip_tun_to_nlattr(struct sk_buff *skb,
struct ip_tunnel_info *tun_info)
{ … }
static int psample_ip_tun_to_nlattr(struct sk_buff *skb,
struct ip_tunnel_info *tun_info)
{ … }
static int psample_tunnel_meta_len(struct ip_tunnel_info *tun_info)
{ … }
#endif
void psample_sample_packet(struct psample_group *group,
const struct sk_buff *skb, u32 sample_rate,
const struct psample_metadata *md)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __init psample_module_init(void)
{ … }
static void __exit psample_module_exit(void)
{ … }
module_init(…) …;
module_exit(psample_module_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;