#include "ratelimiter.h"
#include <linux/siphash.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <net/ip.h>
static struct kmem_cache *entry_cache;
static hsiphash_key_t key;
static spinlock_t table_lock = …;
static DEFINE_MUTEX(init_lock);
static u64 init_refcnt;
static atomic_t total_entries = …;
static unsigned int max_entries, table_size;
static void wg_ratelimiter_gc_entries(struct work_struct *);
static DECLARE_DEFERRABLE_WORK(gc_work, wg_ratelimiter_gc_entries);
static struct hlist_head *table_v4;
#if IS_ENABLED(CONFIG_IPV6)
static struct hlist_head *table_v6;
#endif
struct ratelimiter_entry { … };
enum { … };
static void entry_free(struct rcu_head *rcu)
{ … }
static void entry_uninit(struct ratelimiter_entry *entry)
{ … }
static void wg_ratelimiter_gc_entries(struct work_struct *work)
{ … }
bool wg_ratelimiter_allow(struct sk_buff *skb, struct net *net)
{ … }
int wg_ratelimiter_init(void)
{ … }
void wg_ratelimiter_uninit(void)
{ … }
#include "selftest/ratelimiter.c"