summaryrefslogtreecommitdiffstats
path: root/pool.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-12-14 01:09:11 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2005-12-14 01:09:11 +0000
commit92bbb061acc027bbe29a8973422a60eda5bff88e (patch)
tree8e0831c042ebf8eb59992463a499dbe25851a630 /pool.c
parent6d89ede657243804ff9014141f9500312256cd6b (diff)
downloadopenvpn-92bbb061acc027bbe29a8973422a60eda5bff88e.tar.gz
openvpn-92bbb061acc027bbe29a8973422a60eda5bff88e.tar.xz
openvpn-92bbb061acc027bbe29a8973422a60eda5bff88e.zip
svn merge -r 845:854 $SO/trunk/openvpn .
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@855 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'pool.c')
-rw-r--r--pool.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/pool.c b/pool.c
index 95682f7..cb666b8 100644
--- a/pool.c
+++ b/pool.c
@@ -109,6 +109,33 @@ ifconfig_pool_find (struct ifconfig_pool *pool, const char *common_name)
return -1;
}
+/*
+ * Verify start/end range
+ */
+bool
+ifconfig_pool_verify_range (const int msglevel, const in_addr_t start, const in_addr_t end)
+{
+ struct gc_arena gc = gc_new ();
+ bool ret = true;
+
+ if (start > end)
+ {
+ msg (msglevel, "--ifconfig-pool start IP [%s] is greater than end IP [%s]",
+ print_in_addr_t (start, 0, &gc),
+ print_in_addr_t (end, 0, &gc));
+ ret = false;
+ }
+ if (end - start >= IFCONFIG_POOL_MAX)
+ {
+ msg (msglevel, "--ifconfig-pool address range is too large [%s -> %s]. Current maximum is %d addresses, as defined by IFCONFIG_POOL_MAX variable.",
+ print_in_addr_t (start, 0, &gc),
+ print_in_addr_t (end, 0, &gc),
+ IFCONFIG_POOL_MAX);
+ ret = false;
+ }
+ gc_free (&gc);
+ return ret;
+}
struct ifconfig_pool *
ifconfig_pool_init (int type, in_addr_t start, in_addr_t end, const bool duplicate_cn)