From: Antonio Quartulli
Date: Sat, 30 May 2020 00:05:54 +0000 (+0200)
Subject: pool: prevent IPv6 pools to be larger than 2^16 addresses
X-Git-Tag: v2.4.10~22
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc0297143494e0a0f08564d90dbb210669d0abf5;p=thirdparty%2Fopenvpn.git
pool: prevent IPv6 pools to be larger than 2^16 addresses
Signed-off-by: Antonio Quartulli
Acked-by: Gert Doering
Message-Id: <20200530000600.1680-2-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19945.html
Signed-off-by: Gert Doering
(cherry picked from commit 81d66a1f14d4be3282dd648ecc2049658e3a65ed)
---
diff --git a/src/openvpn/pool.c b/src/openvpn/pool.c
index da28bc06b..e45bf88a2 100644
--- a/src/openvpn/pool.c
+++ b/src/openvpn/pool.c
@@ -183,7 +183,7 @@ ifconfig_pool_init(int type, in_addr_t start, in_addr_t end,
if (pool->ipv6)
{
pool->base_ipv6 = ipv6_base;
- pool->size_ipv6 = ipv6_netbits>96 ? ( 1<<(128-ipv6_netbits) )
+ pool->size_ipv6 = ipv6_netbits > 112 ? (1 << (128 - ipv6_netbits))
: IFCONFIG_POOL_MAX;
msg( D_IFCONFIG_POOL, "IFCONFIG POOL IPv6: (IPv4) size=%d, size_ipv6=%d, netbits=%d, base_ipv6=%s",