diff options
author | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2005-12-14 01:09:11 +0000 |
---|---|---|
committer | james <james@e7ae566f-a301-0410-adde-c780ea21d3b5> | 2005-12-14 01:09:11 +0000 |
commit | 92bbb061acc027bbe29a8973422a60eda5bff88e (patch) | |
tree | 8e0831c042ebf8eb59992463a499dbe25851a630 /pool.c | |
parent | Don't warn user if he uses user/group/chroot and (diff) | |
download | openvpn-92bbb061acc027bbe29a8973422a60eda5bff88e.tar.xz |
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.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -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) |