diff options
author | stilez <stilez@users.noreply.github.com> | 2016-01-12 08:31:11 +0000 |
---|---|---|
committer | stilez <stilez@users.noreply.github.com> | 2016-01-12 08:31:11 +0000 |
commit | 5bc86d05203a20334fa37b48ac567f89a6b81e7f (patch) | |
tree | 1509672f0e2bc350bbd533a615fed7d92f6ce7b2 /src/usr/local/www/services_dhcp.php | |
parent | f4c114d4a6fcfcd7e69e6a009db683d78d83189d (diff) | |
download | pfsense-5bc86d05203a20334fa37b48ac567f89a6b81e7f.zip pfsense-5bc86d05203a20334fa37b48ac567f89a6b81e7f.tar.gz |
redmine 5702 - switch to high level IPv4 functions instead of low level ip2long32() etc
Diffstat (limited to 'src/usr/local/www/services_dhcp.php')
-rw-r--r-- | src/usr/local/www/services_dhcp.php | 13 |
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 4650051..7256ac8 100644 --- a/src/usr/local/www/services_dhcp.php +++ b/src/usr/local/www/services_dhcp.php @@ -400,14 +400,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."); } @@ -435,15 +435,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; } |