aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/allowedips.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-09-28 03:05:22 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-02 03:41:49 +0200
commit45a53bbaafbca0af90f0fb097b1ff6c151b5d8f0 (patch)
tree9409e8289e08211e35e8cdeef0e509e1e254acc0 /src/allowedips.c
parentpoly1305-mips64: use compiler-defined macros in assembly (diff)
downloadwireguard-monolithic-historical-45a53bbaafbca0af90f0fb097b1ff6c151b5d8f0.tar.xz
wireguard-monolithic-historical-45a53bbaafbca0af90f0fb097b1ff6c151b5d8f0.zip
global: prefix all functions with wg_
I understand why this must be done, though I'm not so happy about having to do it. In some places, it puts us over 80 chars and we have to break lines up in further ugly ways. And in general, I think this makes things harder to read. Yet another thing we must do to please upstream. Maybe this can be replaced in the future by some kind of automatic module namespacing logic in the linker, or even combined with LTO and aggressive symbol stripping. Suggested-by: Andrew Lunn <andrew@lunn.ch>
Diffstat (limited to 'src/allowedips.c')
-rw-r--r--src/allowedips.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/allowedips.c b/src/allowedips.c
index f8f026c..b7dc387 100644
--- a/src/allowedips.c
+++ b/src/allowedips.c
@@ -212,7 +212,7 @@ lookup(struct allowedips_node __rcu *root, u8 bits, const void *be_ip)
retry:
node = find_node(rcu_dereference_bh(root), bits, ip);
if (node) {
- peer = peer_get_maybe_zero(rcu_dereference_bh(node->peer));
+ peer = wg_peer_get_maybe_zero(rcu_dereference_bh(node->peer));
if (!peer)
goto retry;
}
@@ -312,13 +312,13 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *be_key,
return 0;
}
-void allowedips_init(struct allowedips *table)
+void wg_allowedips_init(struct allowedips *table)
{
table->root4 = table->root6 = NULL;
table->seq = 1;
}
-void allowedips_free(struct allowedips *table, struct mutex *lock)
+void wg_allowedips_free(struct allowedips *table, struct mutex *lock)
{
struct allowedips_node __rcu *old4 = table->root4, *old6 = table->root6;
++table->seq;
@@ -332,35 +332,36 @@ void allowedips_free(struct allowedips *table, struct mutex *lock)
lockdep_is_held(lock))->rcu, root_free_rcu);
}
-int allowedips_insert_v4(struct allowedips *table, const struct in_addr *ip,
- u8 cidr, struct wireguard_peer *peer,
- struct mutex *lock)
+int wg_allowedips_insert_v4(struct allowedips *table, const struct in_addr *ip,
+ u8 cidr, struct wireguard_peer *peer,
+ struct mutex *lock)
{
++table->seq;
return add(&table->root4, 32, (const u8 *)ip, cidr, peer, lock);
}
-int allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip,
- u8 cidr, struct wireguard_peer *peer,
- struct mutex *lock)
+int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip,
+ u8 cidr, struct wireguard_peer *peer,
+ struct mutex *lock)
{
++table->seq;
return add(&table->root6, 128, (const u8 *)ip, cidr, peer, lock);
}
-void allowedips_remove_by_peer(struct allowedips *table,
- struct wireguard_peer *peer, struct mutex *lock)
+void wg_allowedips_remove_by_peer(struct allowedips *table,
+ struct wireguard_peer *peer,
+ struct mutex *lock)
{
++table->seq;
walk_remove_by_peer(&table->root4, peer, lock);
walk_remove_by_peer(&table->root6, peer, lock);
}
-int allowedips_walk_by_peer(struct allowedips *table,
- struct allowedips_cursor *cursor,
- struct wireguard_peer *peer,
- int (*func)(void *ctx, const u8 *ip, u8 cidr, int family),
- void *ctx, struct mutex *lock)
+int wg_allowedips_walk_by_peer(struct allowedips *table,
+ struct allowedips_cursor *cursor,
+ struct wireguard_peer *peer,
+ int (*func)(void *ctx, const u8 *ip, u8 cidr, int family),
+ void *ctx, struct mutex *lock)
{
int ret;
@@ -380,8 +381,8 @@ int allowedips_walk_by_peer(struct allowedips *table,
}
/* Returns a strong reference to a peer */
-struct wireguard_peer *allowedips_lookup_dst(struct allowedips *table,
- struct sk_buff *skb)
+struct wireguard_peer *wg_allowedips_lookup_dst(struct allowedips *table,
+ struct sk_buff *skb)
{
if (skb->protocol == htons(ETH_P_IP))
return lookup(table->root4, 32, &ip_hdr(skb)->daddr);
@@ -391,8 +392,8 @@ struct wireguard_peer *allowedips_lookup_dst(struct allowedips *table,
}
/* Returns a strong reference to a peer */
-struct wireguard_peer *allowedips_lookup_src(struct allowedips *table,
- struct sk_buff *skb)
+struct wireguard_peer *wg_allowedips_lookup_src(struct allowedips *table,
+ struct sk_buff *skb)
{
if (skb->protocol == htons(ETH_P_IP))
return lookup(table->root4, 32, &ip_hdr(skb)->saddr);