summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_dhcp_edit.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_edit.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_edit.php')
-rwxr-xr-xusr/local/www/services_dhcp_edit.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/usr/local/www/services_dhcp_edit.php b/usr/local/www/services_dhcp_edit.php
index 185f941..3a5e945 100755
--- a/usr/local/www/services_dhcp_edit.php
+++ b/usr/local/www/services_dhcp_edit.php
@@ -75,6 +75,10 @@ if (!is_array($config['dhcpd'][$if]))
if (!is_array($config['dhcpd'][$if]['staticmap']))
$config['dhcpd'][$if]['staticmap'] = array();
+if (!is_array($config['dhcpd'][$if]['pool']))
+ $config['dhcpd'][$if]['pool'] = array();
+$a_pools = &$config['dhcpd'][$if]['pool'];
+
$static_arp_enabled=isset($config['dhcpd'][$if]['staticarp']);
$netboot_enabled=isset($config['dhcpd'][$if]['netboot']);
$a_maps = &$config['dhcpd'][$if]['staticmap'];
@@ -184,6 +188,13 @@ if ($_POST) {
$input_errors[] = sprintf(gettext("The IP address must not be within the DHCP range for this interface."));
}
+ foreach ($a_pools as $id => $p) {
+ if (is_inrange_v4($_POST['ipaddr'], $p['range']['from'], $p['range']['to'])) {
+ $input_errors[] = gettext("The IP address must not be within the range configured on a DHCP pool for this interface.");
+ break;
+ }
+ }
+
$lansubnet_start = ip2ulong(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
$lansubnet_end = ip2ulong(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
if ((ip2ulong($_POST['ipaddr']) < $lansubnet_start) ||
OpenPOWER on IntegriCloud