mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
dhcp: domain names for IPv6 static maps, tests, alignments
This commit is contained in:
parent
fbf0005d51
commit
aedc25a16e
@ -464,16 +464,12 @@ function system_hosts_generate()
|
||||
killbypid('/var/run/dhcpleases.pid', 'TERM', true);
|
||||
|
||||
$fd = fopen('/etc/hosts', 'w');
|
||||
if (!$fd) {
|
||||
log_error("Error: cannot open hosts file in system_hosts_generate().\n");
|
||||
return 1;
|
||||
if ($fd) {
|
||||
fwrite($fd, $hosts);
|
||||
fclose($fd);
|
||||
}
|
||||
fwrite($fd, $hosts);
|
||||
fclose($fd);
|
||||
|
||||
unbound_hosts_generate();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function system_hostname_configure()
|
||||
|
||||
@ -109,22 +109,19 @@ function reconfigure_dhcpd()
|
||||
killbyname("dhcpd");
|
||||
dhcp_clean_leases();
|
||||
system_hosts_generate();
|
||||
clear_subsystem_dirty('hosts');
|
||||
services_dhcpleases_configure();
|
||||
if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic'])) {
|
||||
services_dnsmasq_configure();
|
||||
clear_subsystem_dirty('hosts');
|
||||
}
|
||||
|
||||
if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
|
||||
/* XXX we're calling unbound for regdhcpstatic, but restart the whole thing? */
|
||||
unbound_configure_do();
|
||||
clear_subsystem_dirty('unbound');
|
||||
}
|
||||
services_dhcpd_configure();
|
||||
|
||||
services_dhcpd_configure();
|
||||
clear_subsystem_dirty('staticmaps');
|
||||
}
|
||||
|
||||
|
||||
$config_copy_fieldsnames = array('enable', 'staticarp', 'failover_peerip', 'dhcpleaseinlocaltime','descr',
|
||||
'defaultleasetime', 'maxleasetime', 'gateway', 'domain', 'domainsearchlist', 'denyunknown', 'ddnsdomain',
|
||||
'ddnsdomainprimary', 'ddnsdomainkeyname', 'ddnsdomainkey', 'ddnsupdate', 'mac_allow', 'mac_deny', 'tftp', 'ldap',
|
||||
|
||||
@ -34,16 +34,13 @@ require_once("system.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once("services.inc");
|
||||
|
||||
|
||||
/**
|
||||
* restart dhcp service
|
||||
*/
|
||||
function reconfigure_dhcpd()
|
||||
{
|
||||
if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic'])) {
|
||||
services_dnsmasq_configure();
|
||||
clear_subsystem_dirty('hosts');
|
||||
}
|
||||
system_hosts_generate();
|
||||
clear_subsystem_dirty('hosts');
|
||||
|
||||
if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
|
||||
/* XXX we're calling unbound for regdhcpstatic, but restart the whole thing? */
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once("services.inc");
|
||||
@ -36,7 +37,6 @@ function staticmapcmp($a, $b)
|
||||
return ipcmp($a['ipaddrv6'], $b['ipaddrv6']);
|
||||
}
|
||||
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// handle identifiers and action
|
||||
if (!empty($_GET['if']) && !empty($config['interfaces'][$_GET['if']])) {
|
||||
@ -51,7 +51,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
|
||||
// read form data
|
||||
$pconfig = array();
|
||||
$config_copy_fieldnames = array('duid', 'hostname', 'ipaddrv6', 'filename' ,'rootpath' ,'descr');
|
||||
$config_copy_fieldnames = array('duid', 'hostname', 'ipaddrv6', 'filename' ,'rootpath' ,'descr', 'domain');
|
||||
foreach ($config_copy_fieldnames as $fieldname) {
|
||||
if (isset($if) && isset($id) && isset($config['dhcpdv6'][$if]['staticmap'][$id][$fieldname])) {
|
||||
$pconfig[$fieldname] = $config['dhcpdv6'][$if]['staticmap'][$id][$fieldname];
|
||||
@ -61,7 +61,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$pconfig[$fieldname] = null;
|
||||
}
|
||||
}
|
||||
|
||||
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$input_errors = array();
|
||||
$pconfig = $_POST;
|
||||
@ -118,7 +117,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
}
|
||||
if (count($input_errors) == 0) {
|
||||
$mapent = array();
|
||||
$config_copy_fieldnames = array('duid', 'ipaddrv6', 'hostname', 'descr', 'filename', 'rootpath');
|
||||
$config_copy_fieldnames = array('duid', 'ipaddrv6', 'hostname', 'descr', 'filename', 'rootpath', 'domain');
|
||||
foreach ($config_copy_fieldnames as $fieldname) {
|
||||
if (!empty($pconfig[$fieldname])) {
|
||||
$mapent[$fieldname] = $pconfig[$fieldname];
|
||||
@ -207,6 +206,15 @@ include("head.inc");
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_domain" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Domain name");?></td>
|
||||
<td>
|
||||
<input name="domain" type="text" value="<?=$pconfig['domain'];?>" />
|
||||
<div class="hidden" for="help_for_domain">
|
||||
<?=gettext("The default is to use the domain name of this system as the default domain name provided by DHCP. You may specify an alternate domain name here.");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if (isset($config['dhcpdv6'][$if]['netboot'])): ?>
|
||||
<tr>
|
||||
<td><a id="help_for_filename" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?= gettext('Netboot filename') ?></td>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user