summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-01-05 09:45:38 -0200
committerRenato Botelho <renato@netgate.com>2016-01-05 09:45:38 -0200
commit1537fc6d027fe31571111bde1310e7f3153f91ea (patch)
tree09da8ac2434b9a73d46033c0239b96eb5933e88a
parentc7cd5f1c5eb92eff8cf557a8def7fdf66eb9734e (diff)
parent49ad2c22b1600c09e543ed244e1b21c6b41d105b (diff)
downloadpfsense-1537fc6d027fe31571111bde1310e7f3153f91ea.zip
pfsense-1537fc6d027fe31571111bde1310e7f3153f91ea.tar.gz
Merge pull request #2342 from phil-davis/patch-2
-rw-r--r--usr/local/www/services_dhcp.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php
index fdd1d43..70b249e 100644
--- a/usr/local/www/services_dhcp.php
+++ b/usr/local/www/services_dhcp.php
@@ -104,6 +104,11 @@ if (is_array($config['dhcpd'][$if])){
$dhcpdconf = array();
else
$dhcpdconf = &$config['dhcpd'][$if];
+
+ if (!is_array($config['dhcpd'][$if]['staticmap'])) {
+ $dhcpdconf['staticmap'] = array();
+ }
+ $a_maps = &$config['dhcpd'][$if]['staticmap'];
}
if (is_array($dhcpdconf)) {
// Global Options
@@ -123,10 +128,6 @@ if (is_array($dhcpdconf)) {
}
$pconfig['dhcpleaseinlocaltime'] = $dhcpleaseinlocaltime;
-
- if (!is_array($dhcpdconf['staticmap']))
- $dhcpdconf['staticmap'] = array();
- $a_maps = &$dhcpdconf['staticmap'];
} else {
// Options that exist only in pools
$pconfig['descr'] = $dhcpdconf['descr'];
@@ -341,16 +342,18 @@ if (isset($_POST['submit'])) {
$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))
+ if (!((ip2ulong($_POST['range_from']) > ip2ulong($rto)) ||
+ (ip2ulong($_POST['range_to']) < ip2ulong($rfrom)))) {
$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'])) {
+ if (!((ip2ulong($_POST['range_from']) > ip2ulong($p['range']['to'])) ||
+ (ip2ulong($_POST['range_to']) < ip2ulong($p['range']['from'])))) {
$input_errors[] = gettext("The specified range must not be within the range configured on a DHCP pool for this interface.");
break;
}
@@ -366,8 +369,8 @@ if (isset($_POST['submit'])) {
foreach ($a_maps as $map) {
if (empty($map['ipaddr']))
continue;
- if ((ip2ulong($map['ipaddr']) > $dynsubnet_start) &&
- (ip2ulong($map['ipaddr']) < $dynsubnet_end)) {
+ if ((ip2ulong($map['ipaddr']) >= $dynsubnet_start) &&
+ (ip2ulong($map['ipaddr']) <= $dynsubnet_end)) {
$input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings."));
break;
}
OpenPOWER on IntegriCloud