summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/services_dhcp.php
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-02-24 08:49:14 -0300
committerRenato Botelho <renato@netgate.com>2016-02-24 11:01:49 -0300
commitb90d635e1c8838a515ec4d751a8ecc9f1e4d5caf (patch)
tree932e78b7be94032023cb61946ce4ec69fe5d0eeb /src/usr/local/www/services_dhcp.php
parentcd3a34fec14b429b8b68283611493541d2ef5c90 (diff)
downloadpfsense-b90d635e1c8838a515ec4d751a8ecc9f1e4d5caf.zip
pfsense-b90d635e1c8838a515ec4d751a8ecc9f1e4d5caf.tar.gz
Simplify logic and use high level functions
Diffstat (limited to 'src/usr/local/www/services_dhcp.php')
-rw-r--r--src/usr/local/www/services_dhcp.php14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php
index 4c88fda..5d88ebd 100644
--- a/src/usr/local/www/services_dhcp.php
+++ b/src/usr/local/www/services_dhcp.php
@@ -226,6 +226,9 @@ if (is_array($dhcpdconf)) {
$ifcfgip = $config['interfaces'][$if]['ipaddr'];
$ifcfgsn = $config['interfaces'][$if]['subnet'];
+$subnet_start = gen_subnetv4($ifcfgip, $ifcfgsn);
+$subnet_end = gen_subnetv4_max($ifcfgip, $ifcfgsn);
+
function validate_partial_mac_list($maclist) {
$macs = explode(',', $maclist);
@@ -426,9 +429,6 @@ if (isset($_POST['submit'])) {
if (!$input_errors) {
/* make sure the range lies within the current subnet */
- $subnet_start = gen_subnetv4($ifcfgip, $ifcfgsn);
- $subnet_end = gen_subnetv4_max($ifcfgip, $ifcfgsn);
-
if (ip_greater_than($_POST['range_from'], $_POST['range_to'])) {
$input_errors[] = gettext("The range is invalid (first element higher than second element).");
}
@@ -827,13 +827,7 @@ $section->addInput(new Form_StaticText(
));
// Compose a string to display the required address ranges
-$range_from = ip2long(gen_subnetv4($ifcfgip, $ifcfgsn));
-$range_from++;
-
-$range_to = ip2long(gen_subnetv4_max($ifcfgip, $ifcfgsn));
-$range_to--;
-
-$rangestr = long2ip32($range_from) . ' - ' . long2ip32($range_to);
+$rangestr = ip_after($subnet_start) . ' - ' . ip_before($subnet_end);
if (is_numeric($pool) || ($act == "newpool")) {
$rangestr .= '<br />' . gettext('In-use DHCP Pool Ranges:');
OpenPOWER on IntegriCloud