summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_dhcp.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-01-24 12:39:41 -0200
committerRenato Botelho <garga@FreeBSD.org>2013-01-24 12:39:41 -0200
commitf657f5e1e407a4687983b6e9907f0dc489945157 (patch)
tree393dd6be3a3c820b4a0b917db634f7617aa51276 /usr/local/www/services_dhcp.php
parent41b4867edaa639a819d9c998c766397c4844bad5 (diff)
downloadpfsense-f657f5e1e407a4687983b6e9907f0dc489945157.zip
pfsense-f657f5e1e407a4687983b6e9907f0dc489945157.tar.gz
Ensure DHCP main range, pools ranges and static IP addresses don't overlap each other. It should fix #2773
Diffstat (limited to 'usr/local/www/services_dhcp.php')
-rwxr-xr-xusr/local/www/services_dhcp.php21
1 files changed, 18 insertions, 3 deletions
diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php
index fcaad50..37e25be 100755
--- a/usr/local/www/services_dhcp.php
+++ b/usr/local/www/services_dhcp.php
@@ -343,9 +343,24 @@ if ($_POST) {
if (ip2ulong($_POST['range_from']) > ip2ulong($_POST['range_to']))
$input_errors[] = gettext("The range is invalid (first element higher than second element).");
- // TODO: Ensure range and pools do not overlap!
- // If we're editing the main range, check pools
- // If we're editing a pool, locate parent range and other pools.
+ if (is_numeric($pool) || ($act == "newpool")) {
+ $rfrom = $config['dhcpd'][$if]['range']['from'];
+ $rto = $config['dhcpd'][$if]['range']['to'];
+
+ if (is_inrange_v4($_POST['range_from'], $rfrom, $rto) || is_inrange_v4($_POST['range_to'], $rfrom, $rto))
+ $input_errors[] = gettext("The specified range must not be within the DHCP range for this interface.");
+ }
+
+ foreach ($a_pools as $id => $p) {
+ if (is_numeric($pool) && ($id == $pool))
+ continue;
+
+ if (is_inrange_v4($_POST['range_from'], $p['range']['from'], $p['range']['to']) ||
+ is_inrange_v4($_POST['range_to'], $p['range']['from'], $p['range']['to'])) {
+ $input_errors[] = gettext("The specified range must not be within the range configured on a DHCP pool for this interface.");
+ break;
+ }
+ }
/* make sure that the DHCP Relay isn't enabled on this interface */
if (isset($config['dhcrelay']['enable']) && (stristr($config['dhcrelay']['interface'], $if) !== false))
OpenPOWER on IntegriCloud