mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Use high level functions
This commit is contained in:
parent
30c8a2902a
commit
4b6c15cd8d
@ -190,7 +190,9 @@ if (is_array($config['dhcpd'][$argv[1]])) {
|
||||
$subnet_start = gen_subnetv4($ifcfgip, $ifcfgsn);
|
||||
$subnet_end = gen_subnetv4_max($ifcfgip, $ifcfgsn);
|
||||
|
||||
$result['range'] = (ip2ulong($config['dhcpd'][$dhcpif]['range']['to'])) - (ip2ulong($config['dhcpd'][$dhcpif]['range']['from']));
|
||||
$result['range'] = ip_range_size_v4(
|
||||
$config['dhcpd'][$dhcpif]['range']['from'],
|
||||
$config['dhcpd'][$dhcpif]['range']['to']);
|
||||
|
||||
foreach ($leases as $data) {
|
||||
if ($data['act'] != "active" && $data['act'] != "static" && $_GET['all'] != 1)
|
||||
|
||||
@ -249,19 +249,17 @@ if ($_POST) {
|
||||
}
|
||||
}
|
||||
|
||||
$lansubnet_start = ip2ulong(gen_subnetv4($ifcfgip, $ifcfgsn));
|
||||
$lansubnet_end = ip2ulong(gen_subnetv4_max($ifcfgip, $ifcfgsn));
|
||||
$ipaddr_int = ip2ulong($_POST['ipaddr']);
|
||||
if (($ipaddr_int < $lansubnet_start) ||
|
||||
($ipaddr_int > $lansubnet_end)) {
|
||||
$lansubnet_start = gen_subnetv4($ifcfgip, $ifcfgsn);
|
||||
$lansubnet_end = gen_subnetv4_max($ifcfgip, $ifcfgsn);
|
||||
if (!is_inrange_v4($_POST['ipaddr'], $lansubnet_start, $lansubnet_end)) {
|
||||
$input_errors[] = sprintf(gettext("The IP address must lie in the %s subnet."), $ifcfgdescr);
|
||||
}
|
||||
|
||||
if ($ipaddr_int == $lansubnet_start) {
|
||||
if ($_POST['ipaddr'] == $lansubnet_start) {
|
||||
$input_errors[] = sprintf(gettext("The IP address cannot be the %s network address."), $ifcfgdescr);
|
||||
}
|
||||
|
||||
if ($ipaddr_int == $lansubnet_end) {
|
||||
if ($_POST['ipaddr'] == $lansubnet_end) {
|
||||
$input_errors[] = sprintf(gettext("The IP address cannot be the %s broadcast address."), $ifcfgdescr);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user