mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 10:04:41 +00:00
DHCP: Add min-secs option for each subnet (#4486)
This commit is contained in:
parent
d70a1aae03
commit
28caaf7342
@ -990,6 +990,12 @@ EOD;
|
||||
if (!empty($dhcpifconf['maxleasetime'])) {
|
||||
$dhcpdconf .= " max-lease-time {$dhcpifconf['maxleasetime']};\n";
|
||||
}
|
||||
|
||||
// min-secs
|
||||
if (!empty($dhcpifconf['minsecs'])) {
|
||||
$dhcpdconf .= " min-secs {$dhcpifconf['minsecs']};\n";
|
||||
}
|
||||
|
||||
// interface MTU
|
||||
if (!empty($dhcpifconf['interface_mtu'])) {
|
||||
$dhcpdconf .= " option interface-mtu {$dhcpifconf['interface_mtu']};\n";
|
||||
@ -1501,6 +1507,11 @@ EOD;
|
||||
$dhcpdv6conf .= " max-lease-time {$dhcpv6ifconf['maxleasetime']};\n";
|
||||
}
|
||||
|
||||
// min-secs
|
||||
if (!empty($dhcpv6ifconf['minsecs'])) {
|
||||
$dhcpdv6conf .= " min-secs {$dhcpv6ifconf['minsecs']};\n";
|
||||
}
|
||||
|
||||
// ntp-servers
|
||||
if (isset($dhcpv6ifconf['ntpserver'][0])) {
|
||||
$ntpservers = array();
|
||||
|
||||
@ -97,7 +97,7 @@ $config_copy_fieldsnames = array('enable', 'staticarp', 'failover_peerip', 'fail
|
||||
'defaultleasetime', 'maxleasetime', 'gateway', 'domain', 'domainsearchlist', 'denyunknown', 'ddnsdomain',
|
||||
'ddnsdomainprimary', 'ddnsdomainkeyname', 'ddnsdomainkey', 'ddnsdomainalgorithm', 'ddnsupdate', 'mac_allow',
|
||||
'mac_deny', 'tftp', 'bootfilename', 'ldap', 'netboot', 'nextserver', 'filename', 'filename32', 'filename64',
|
||||
'rootpath', 'netmask', 'numberoptions', 'interface_mtu', 'wpad', 'omapi', 'omapiport', 'omapialgorithm', 'omapikey');
|
||||
'rootpath', 'netmask', 'numberoptions', 'interface_mtu', 'wpad', 'omapi', 'omapiport', 'omapialgorithm', 'omapikey', 'minsecs');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// handle identifiers and action
|
||||
@ -226,6 +226,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
if (!empty($pconfig['maxleasetime']) && (!is_numeric($pconfig['maxleasetime']) || ($pconfig['maxleasetime'] < 60) || ($pconfig['maxleasetime'] <= $pconfig['defaultleasetime']))) {
|
||||
$input_errors[] = gettext("The maximum lease time must be at least 60 seconds and higher than the default lease time.");
|
||||
}
|
||||
|
||||
if (!empty($pconfig['minsecs']) && (!is_numeric($pconfig['minsecs']) || ($pconfig['minsecs'] < 0) || ($pconfig['minsecs'] > 255))) {
|
||||
$input_errors[] = gettext("The response delay must be higher than 0 and no more than 255 seconds.");
|
||||
}
|
||||
|
||||
if ((!empty($pconfig['ddnsdomain']) && !is_domain($pconfig['ddnsdomain']))) {
|
||||
$input_errors[] = gettext("A valid domain name must be specified for the dynamic DNS registration.");
|
||||
}
|
||||
@ -842,6 +847,16 @@ include("head.inc");
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_minsecs" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Response delay");?> (<?=gettext("seconds");?>)</td>
|
||||
<td>
|
||||
<input name="minsecs" type="text" id="minsecs" value="<?=$pconfig['minsecs'];?>" />
|
||||
<div class="hidden" data-for="help_for_minsecs">
|
||||
<?=gettext("This is the minimum number of seconds since a client began trying to acquire a new lease before the DHCP server will respond to its request."); ?><br/>
|
||||
<?=gettext("The default is 0 seconds (no delay).");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_interface_mtu" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Interface MTU");?></td>
|
||||
<td>
|
||||
|
||||
@ -65,7 +65,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
}
|
||||
$config_copy_fieldsnames = array('defaultleasetime', 'maxleasetime', 'domain', 'domainsearchlist', 'ddnsdomain',
|
||||
'ddnsdomainprimary', 'ddnsdomainkeyname', 'ddnsdomainkey', 'ddnsdomainalgorithm', 'bootfile_url', 'netmask',
|
||||
'numberoptions', 'dhcpv6leaseinlocaltime', 'staticmap');
|
||||
'numberoptions', 'dhcpv6leaseinlocaltime', 'staticmap', 'minsecs');
|
||||
foreach ($config_copy_fieldsnames as $fieldname) {
|
||||
if (isset($config['dhcpdv6'][$if][$fieldname])) {
|
||||
$pconfig[$fieldname] = $config['dhcpdv6'][$if][$fieldname];
|
||||
@ -155,6 +155,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
if (!empty($pconfig['maxleasetime']) && (!is_numeric($pconfig['maxleasetime']) || ($pconfig['maxleasetime'] < 60) || ($pconfig['maxleasetime'] <= $_POST['defaultleasetime']))) {
|
||||
$input_errors[] = gettext("The maximum lease time must be at least 60 seconds and higher than the default lease time.");
|
||||
}
|
||||
if (!empty($pconfig['minsecs']) && (!is_numeric($pconfig['minsecs']) || ($pconfig['minsecs'] < 0) || ($pconfig['minsecs'] > 255))) {
|
||||
$input_errors[] = gettext("The response delay must be at least 0 and no more than 255 seconds.");
|
||||
}
|
||||
if (!empty($pconfig['ddnsdomain']) && !is_domain($pconfig['ddnsdomain'])) {
|
||||
$input_errors[] = gettext("A valid domain name must be specified for the dynamic DNS registration.");
|
||||
}
|
||||
@ -241,7 +244,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// simple 1-on-1 copy
|
||||
$config_copy_fieldsnames = array('defaultleasetime', 'maxleasetime', 'netmask', 'domainsearchlist',
|
||||
'ddnsdomain', 'ddnsdomainprimary', 'ddnsdomainkeyname', 'ddnsdomainkey', 'ddnsdomainalgorithm', 'bootfile_url',
|
||||
'dhcpv6leaseinlocaltime');
|
||||
'dhcpv6leaseinlocaltime', 'minsecs');
|
||||
foreach ($config_copy_fieldsnames as $fieldname) {
|
||||
if (!empty($pconfig[$fieldname])) {
|
||||
$dhcpdconf[$fieldname] = $pconfig[$fieldname];
|
||||
@ -587,6 +590,16 @@ if (isset($config['interfaces'][$if]['dhcpd6track6allowoverride'])) {
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_minsecs" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Response delay");?> (<?=gettext("seconds");?>)</td>
|
||||
<td>
|
||||
<input name="minsecs" type="text" value="<?=$pconfig['minsecs'];?>" />
|
||||
<div class="hidden" data-for="help_for_minsecs">
|
||||
<?=gettext("This is the minimum number of seconds since a client began trying to acquire a new lease before the DHCP server will respond to its request."); ?><br />
|
||||
<?=gettext("The default is 0 seconds (no delay).");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_dhcpv6leaseinlocaltime" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Time format change"); ?></td>
|
||||
<td>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user