aboutsummaryrefslogtreecommitdiff
path: root/src/openvpn/pool.c
diff options
context:
space:
mode:
authorAntonio Quartulli2020-06-08 22:16:13 +0200
committerGert Doering2020-06-09 15:58:19 +0200
commit1379e5271d0057fcaed82d6985e614ca2ed8c265 (patch)
treeb90c9f2c5396a816e71bec367361ba5eb1b5416a /src/openvpn/pool.c
parent070319c13524125d8325a0df15fe795cc2a4bcf2 (diff)
downloadopenvpn-1379e5271d0057fcaed82d6985e614ca2ed8c265.zip
openvpn-1379e5271d0057fcaed82d6985e614ca2ed8c265.tar.gz
ipv6-pool: get rid of size constraint
Signed-off-by: Antonio Quartulli <a@unstable.cc> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20200608201613.23750-1-a@unstable.cc> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20005.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src/openvpn/pool.c')
-rw-r--r--src/openvpn/pool.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/openvpn/pool.c b/src/openvpn/pool.c
index 4e30371..2966762 100644
--- a/src/openvpn/pool.c
+++ b/src/openvpn/pool.c
@@ -207,6 +207,12 @@ ifconfig_pool_init(const bool ipv4_pool, enum pool_type type, in_addr_t start,
ASSERT(0);
}
+ if (pool->ipv4.size < 2)
+ {
+ msg(M_FATAL, "IPv4 pool size is too small (%d), must be at least 2",
+ pool->ipv4.size);
+ }
+
msg(D_IFCONFIG_POOL, "IFCONFIG POOL IPv4: base=%s size=%d",
print_in_addr_t(pool->ipv4.base, 0, &gc), pool->ipv4.size);
}
@@ -245,6 +251,12 @@ ifconfig_pool_init(const bool ipv4_pool, enum pool_type type, in_addr_t start,
? (1 << (128 - ipv6_netbits)) - base
: IFCONFIG_POOL_MAX;
+ if (pool->ipv6.size < 2)
+ {
+ msg(M_FATAL, "IPv6 pool size is too small (%d), must be at least 2",
+ pool->ipv6.size);
+ }
+
msg(D_IFCONFIG_POOL, "IFCONFIG POOL IPv6: base=%s size=%d netbits=%d",
print_in6_addr(pool->ipv6.base, 0, &gc), pool->ipv6.size,
ipv6_netbits);