summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_dhcp.php
diff options
context:
space:
mode:
authorErik Fonnesbeck <efonnes@gmail.com>2010-05-20 10:48:39 -0600
committerErik Fonnesbeck <efonnes@gmail.com>2010-05-20 10:55:02 -0600
commit9603306327f07205ac69ea99b8c0666ba9dc8a1d (patch)
tree105765d1e09bbb9eea4dacfb7ff0f2cb1f943a89 /usr/local/www/services_dhcp.php
parent986a3accd40a7d45c0a3d48d2b42d2c58a231d99 (diff)
downloadpfsense-9603306327f07205ac69ea99b8c0666ba9dc8a1d.zip
pfsense-9603306327f07205ac69ea99b8c0666ba9dc8a1d.tar.gz
Various fixes to usage of ip2long, long2ip, and negated subnet masks, mostly affecting 64-bit. Ticket #459
Diffstat (limited to 'usr/local/www/services_dhcp.php')
-rwxr-xr-xusr/local/www/services_dhcp.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php
index cc3d1e4..b72258f 100755
--- a/usr/local/www/services_dhcp.php
+++ b/usr/local/www/services_dhcp.php
@@ -181,7 +181,7 @@ if(is_array($dhcrelaycfg)) {
}
function is_inrange($test, $start, $end) {
- if ( (ip2long($test) < ip2long($end)) && (ip2long($test) > ip2long($start)) )
+ if ( (ip2ulong($test) < ip2ulong($end)) && (ip2ulong($test) > ip2ulong($start)) )
return true;
else
return false;
@@ -242,15 +242,15 @@ if ($_POST) {
if (!$input_errors) {
/* make sure the range lies within the current subnet */
- $subnet_start = (ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn));
- $subnet_end = (ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn)));
+ $subnet_start = ip2ulong(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
+ $subnet_end = ip2ulong(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
- if ((ip2long($_POST['range_from']) < $subnet_start) || (ip2long($_POST['range_from']) > $subnet_end) ||
- (ip2long($_POST['range_to']) < $subnet_start) || (ip2long($_POST['range_to']) > $subnet_end)) {
+ if ((ip2ulong($_POST['range_from']) < $subnet_start) || (ip2ulong($_POST['range_from']) > $subnet_end) ||
+ (ip2ulong($_POST['range_to']) < $subnet_start) || (ip2ulong($_POST['range_to']) > $subnet_end)) {
$input_errors[] = "The specified range lies outside of the current subnet.";
}
- if (ip2long($_POST['range_from']) > ip2long($_POST['range_to']))
+ if (ip2ulong($_POST['range_from']) > ip2ulong($_POST['range_to']))
$input_errors[] = "The range is invalid (first element higher than second element).";
/* make sure that the DHCP Relay isn't enabled on this interface */
@@ -534,15 +534,15 @@ include("head.inc");
<td width="22%" valign="top" class="vncellreq">Available range</td>
<td width="78%" class="vtable">
<?php
- $range_from = ip2long(long2ip(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
+ $range_from = ip2long(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
$range_from++;
- echo long2ip($range_from);
+ echo long2ip32($range_from);
?>
-
<?php
- $range_to = ip2long(long2ip(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
+ $range_to = ip2long(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
$range_to--;
- echo long2ip($range_to);
+ echo long2ip32($range_to);
?>
</td>
</tr>
OpenPOWER on IntegriCloud