diff options
author | Bill Marquette <billm@pfsense.org> | 2005-08-20 00:45:13 +0000 |
---|---|---|
committer | Bill Marquette <billm@pfsense.org> | 2005-08-20 00:45:13 +0000 |
commit | 0ea7462d9e62e0267eb96027766f1610481b5e64 (patch) | |
tree | 255a1a2dc573fdeb2e1b116da26f836f17bb22a4 /usr/local/www/services_dhcp.php | |
parent | ea166a33c8da4261077255aa335320ee7a946fb1 (diff) | |
download | pfsense-0ea7462d9e62e0267eb96027766f1610481b5e64.zip pfsense-0ea7462d9e62e0267eb96027766f1610481b5e64.tar.gz |
(#382) - don't allow users to overlap the dynamic IP range over the static IPs
Diffstat (limited to 'usr/local/www/services_dhcp.php')
-rwxr-xr-x | usr/local/www/services_dhcp.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php index f396646..3db5e20 100755 --- a/usr/local/www/services_dhcp.php +++ b/usr/local/www/services_dhcp.php @@ -68,6 +68,19 @@ if (!is_array($config['dhcpd'][$if]['staticmap'])) { staticmaps_sort($if); $a_maps = &$config['dhcpd'][$if]['staticmap']; +function is_inrange($test, $start, $end) { + $tmp = explode(".", $test); + $o_test = $tmp[3]; + $tmp = explode(".", $start); + $o_start = $tmp[3]; + $tmp = explode(".", $end); + $o_end = $tmp[3]; + + if ( ($o_test < $o_end) && ($o_test > $o_start) ) + return true; + else + return false; +} if ($_POST) { @@ -81,6 +94,13 @@ if ($_POST) { $reqdfieldsn = explode(",", "Range begin,Range end"); do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + + foreach($a_maps as $mapent) { + if(is_inrange($mapent['ipaddr'], $_POST['range_from'], $_POST['range_to'])) { + $input_errors[] = "{$mapent['ipaddr']} is inside the range you specified."; + } + + } if (($_POST['range_from'] && !is_ipaddr($_POST['range_from']))) { $input_errors[] = "A valid range must be specified."; |