summaryrefslogtreecommitdiffhomepage
path: root/src/selftest/allowedips.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-10-08 22:54:32 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-09 01:57:47 +0200
commit1564e913bf02a924116497bdb8c1b994298c0465 (patch)
treebd28848929af527602fd0e8474cf50670221b9a0 /src/selftest/allowedips.c
parent11d9063c3d2084a6eeb78aaaf5cadc9b8a2ff437 (diff)
global: give if statements brackets and other cleanups
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/selftest/allowedips.c')
-rw-r--r--src/selftest/allowedips.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/selftest/allowedips.c b/src/selftest/allowedips.c
index fdedfef..74d1472 100644
--- a/src/selftest/allowedips.c
+++ b/src/selftest/allowedips.c
@@ -72,6 +72,7 @@ static __init void print_node(struct allowedips_node *node, u8 bits)
print_node(node->bit[1], bits);
}
}
+
static __init void print_tree(struct allowedips_node *top, u8 bits)
{
printk(KERN_DEBUG "digraph trie {\n");
@@ -135,9 +136,9 @@ static __init inline u8 horrible_mask_to_cidr(union nf_inet_addr subnet)
static __init inline void
horrible_mask_self(struct horrible_allowedips_node *node)
{
- if (node->ip_version == 4)
+ if (node->ip_version == 4) {
node->ip.ip &= node->mask.ip;
- else if (node->ip_version == 6) {
+ } else if (node->ip_version == 6) {
node->ip.ip6[0] &= node->mask.ip6[0];
node->ip.ip6[1] &= node->mask.ip6[1];
node->ip.ip6[2] &= node->mask.ip6[2];
@@ -487,6 +488,7 @@ static __init int walk_callback(void *ctx, const u8 *ip, u8 cidr, int family)
static __init struct wg_peer *init_peer(void)
{
struct wg_peer *peer = kzalloc(sizeof(*peer), GFP_KERNEL);
+
if (peer)
kref_init(&peer->refcount);
return peer;