summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/services_dhcp.php
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-02-24 11:01:43 -0300
committerRenato Botelho <renato@netgate.com>2016-02-24 11:01:43 -0300
commitcd3a34fec14b429b8b68283611493541d2ef5c90 (patch)
tree6dfcc877e7f5ca5236cb692e2180a0ce73158086 /src/usr/local/www/services_dhcp.php
parentf9d7a78a1005eeed84637a5f6c33c34837522b21 (diff)
parent5d4c261603a9607836c6549edc12a55cd2bd2f39 (diff)
downloadpfsense-cd3a34fec14b429b8b68283611493541d2ef5c90.zip
pfsense-cd3a34fec14b429b8b68283611493541d2ef5c90.tar.gz
Merge pull request #2409 from stilez/patch-13
Diffstat (limited to 'src/usr/local/www/services_dhcp.php')
-rw-r--r--src/usr/local/www/services_dhcp.php13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php
index f477320..4c88fda 100644
--- a/src/usr/local/www/services_dhcp.php
+++ b/src/usr/local/www/services_dhcp.php
@@ -426,14 +426,14 @@ if (isset($_POST['submit'])) {
if (!$input_errors) {
/* make sure the range lies within the current subnet */
- $subnet_start = ip2ulong(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
- $subnet_end = ip2ulong(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
+ $subnet_start = gen_subnetv4($ifcfgip, $ifcfgsn);
+ $subnet_end = gen_subnetv4_max($ifcfgip, $ifcfgsn);
- if (ip2ulong($_POST['range_from']) > ip2ulong($_POST['range_to'])) {
+ if (ip_greater_than($_POST['range_from'], $_POST['range_to'])) {
$input_errors[] = gettext("The range is invalid (first element higher than second element).");
}
- if (ip2ulong($_POST['range_from']) < $subnet_start || ip2ulong($_POST['range_to']) > $subnet_end) {
+ if (!is_inrange_v4($_POST['range_from'], $subnet_start, $subnet_end)) {
$input_errors[] = gettext("The specified range lies outside of the current subnet.");
}
@@ -461,15 +461,12 @@ if (isset($_POST['submit'])) {
$input_errors[] = sprintf(gettext("You must disable the DHCP relay on the %s interface before enabling the DHCP server."), $iflist[$if]);
}
- $dynsubnet_start = ip2ulong($_POST['range_from']);
- $dynsubnet_end = ip2ulong($_POST['range_to']);
if (is_array($a_maps)) {
foreach ($a_maps as $map) {
if (empty($map['ipaddr'])) {
continue;
}
- if ((ip2ulong($map['ipaddr']) >= $dynsubnet_start) &&
- (ip2ulong($map['ipaddr']) <= $dynsubnet_end)) {
+ if (is_inrange_v4($map['ipaddr'], $_POST['range_from'], $_POST['range_to'])) {
$input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings."));
break;
}
OpenPOWER on IntegriCloud