#include "allowedips.h"
#include "peer.h"
enum { … };
static struct kmem_cache *node_cache;
static void swap_endian(u8 *dst, const u8 *src, u8 bits)
{ … }
static void copy_and_assign_cidr(struct allowedips_node *node, const u8 *src,
u8 cidr, u8 bits)
{ … }
static inline u8 choose(struct allowedips_node *node, const u8 *key)
{ … }
static void push_rcu(struct allowedips_node **stack,
struct allowedips_node __rcu *p, unsigned int *len)
{ … }
static void node_free_rcu(struct rcu_head *rcu)
{ … }
static void root_free_rcu(struct rcu_head *rcu)
{ … }
static void root_remove_peer_lists(struct allowedips_node *root)
{ … }
static unsigned int fls128(u64 a, u64 b)
{ … }
static u8 common_bits(const struct allowedips_node *node, const u8 *key,
u8 bits)
{ … }
static bool prefix_matches(const struct allowedips_node *node, const u8 *key,
u8 bits)
{ … }
static struct allowedips_node *find_node(struct allowedips_node *trie, u8 bits,
const u8 *key)
{ … }
static struct wg_peer *lookup(struct allowedips_node __rcu *root, u8 bits,
const void *be_ip)
{ … }
static bool node_placement(struct allowedips_node __rcu *trie, const u8 *key,
u8 cidr, u8 bits, struct allowedips_node **rnode,
struct mutex *lock)
{ … }
static inline void connect_node(struct allowedips_node __rcu **parent, u8 bit, struct allowedips_node *node)
{ … }
static inline void choose_and_connect_node(struct allowedips_node *parent, struct allowedips_node *node)
{ … }
static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key,
u8 cidr, struct wg_peer *peer, struct mutex *lock)
{ … }
void wg_allowedips_init(struct allowedips *table)
{ … }
void wg_allowedips_free(struct allowedips *table, struct mutex *lock)
{ … }
int wg_allowedips_insert_v4(struct allowedips *table, const struct in_addr *ip,
u8 cidr, struct wg_peer *peer, struct mutex *lock)
{ … }
int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip,
u8 cidr, struct wg_peer *peer, struct mutex *lock)
{ … }
void wg_allowedips_remove_by_peer(struct allowedips *table,
struct wg_peer *peer, struct mutex *lock)
{ … }
int wg_allowedips_read_node(struct allowedips_node *node, u8 ip[16], u8 *cidr)
{ … }
struct wg_peer *wg_allowedips_lookup_dst(struct allowedips *table,
struct sk_buff *skb)
{ … }
struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table,
struct sk_buff *skb)
{ … }
int __init wg_allowedips_slab_init(void)
{ … }
void wg_allowedips_slab_uninit(void)
{ … }
#include "selftest/allowedips.c"