summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-10 18:40:38 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-10 19:23:02 +0200
commit9a2036bbe12e8556f5df99c151b3e1233e6494b5 (patch)
treea6ba5d848f3a7e5d3be54500a846c6a003c6726c
parent1450151d48e6ba09e16ac26804ba2b44e4a96539 (diff)
allowedips: simplify arithmetic
Suggested-by: Samuel Neves <sneves@dei.uc.pt> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--src/allowedips.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/allowedips.c b/src/allowedips.c
index 4b2f6c7..293bb75 100644
--- a/src/allowedips.c
+++ b/src/allowedips.c
@@ -81,7 +81,7 @@ static int walk_by_peer(struct allowedips_node __rcu *top, u8 bits, struct allow
swap_endian(ip, node->bits, bits);
memset(ip + (node->cidr + 7U) / 8U, 0, (bits / 8U) - ((node->cidr + 7U) / 8U));
if (node->cidr)
- ip[(node->cidr + 7U) / 8U - 1U] &= ~0U << ((8U - (node->cidr % 8U)) % 8U);
+ ip[(node->cidr + 7U) / 8U - 1U] &= ~0U << (-node->cidr % 8U);
ret = func(ctx, ip, node->cidr, bits == 32 ? AF_INET : AF_INET6);
if (ret)