Make the changes suggested by jim-p and changed the way the disable function work to ensure the manually added host entries or DHCP reservations still work.

This commit is contained in:
Robbert Rijkse 2017-05-09 19:52:13 -04:00
parent 409165fde8
commit 49d9b45f92
3 changed files with 25 additions and 28 deletions

View File

@ -489,7 +489,10 @@ function system_hosts_dhcpd_entries() {
/* Concatenate local, dnsmasq/unbound and dhcpd/dhcpdv6 hosts entries */
function system_hosts_entries($dnscfg) {
$local = system_hosts_local_entries();
$local = array();
if (!isset($dnscfg['disable_auto_added_host_entries'])) {
$local = system_hosts_local_entries();
}
$dns = array();
$dhcpd = array();
@ -1192,7 +1195,7 @@ EOD;
}
}
}
$syslogd_sockets = "";
foreach ($log_sockets as $log_socket) {
// Ensure that the log directory exists
@ -2155,7 +2158,7 @@ function system_dmesg_save() {
fclose($fd);
unset($dmesg);
// vm-bhyve expects dmesg.boot at the standard location
@symlink("{$g['varlog_path']}/dmesg.boot", "{$g['varrun_path']}/dmesg.boot");

View File

@ -549,29 +549,24 @@ function unbound_add_host_entries($cfgsubdir = "") {
}
$unbound_entries = "local-zone: \"{$config['system']['domain']}\" {$system_domain_local_zone_type}\n";
$hosts = system_hosts_entries($config['unbound']);
$added_ptr = array();
foreach ($hosts as $host) {
if (is_ipaddrv4($host['ipaddr'])) {
$type = 'A';
} else if (is_ipaddrv6($host['ipaddr'])) {
$type = 'AAAA';
} else {
continue;
}
if (!$added_ptr[$host['ipaddr']]) {
$unbound_entries .= "local-data-ptr: \"{$host['ipaddr']} {$host['fqdn']}\"\n";
$added_ptr[$host['ipaddr']] = true;
}
$unbound_entries .= "local-data: \"{$host['fqdn']} {$type} {$host['ipaddr']}\"\n";
}
}
else {
// Adds a comment to the file to make it clear it's there for a reason and to clear the file
// when the user enables this option.
$unbound_entries = "# Empty since file generation has been disabled in the options.";
$hosts = system_hosts_entries($config['unbound']);
$added_ptr = array();
foreach ($hosts as $host) {
if (is_ipaddrv4($host['ipaddr'])) {
$type = 'A';
} else if (is_ipaddrv6($host['ipaddr'])) {
$type = 'AAAA';
} else {
continue;
}
if (!$added_ptr[$host['ipaddr']]) {
$unbound_entries .= "local-data-ptr: \"{$host['ipaddr']} {$host['fqdn']}\"\n";
$added_ptr[$host['ipaddr']] = true;
}
$unbound_entries .= "local-data: \"{$host['fqdn']} {$type} {$host['ipaddr']}\"\n";
}
// Write out entries

View File

@ -71,7 +71,7 @@ if (isset($config['unbound']['disable_auto_added_access_control'])) {
$pconfig['disable_auto_added_access_control'] = true;
}
if (isset($config['unbound']['disable_auto_host_entries'])) {
if (isset($config['unbound']['disable_auto_added_host_entries'])) {
$pconfig['disable_auto_added_host_entries'] = true;
}
@ -364,8 +364,7 @@ $section->addInput(new Form_Checkbox(
'Disable Auto-added Host Entries',
'Disable the automatically-added host entries',
$pconfig['disable_auto_added_host_entries']
))->setHelp('By default, the primary IPv4 and IPv6 addresses of the pfsense machine are added as records for the pfSense system domain (System | General Setup | Domain). ' .
'This disables the auto generation of these entries.');
))->setHelp('By default, the primary IPv4 and IPv6 addresses of of this firewall are added as records for the system domain of this firewall as configured in %1$sSystem: General Setup%2$s. This disables the auto generation of these entries.', '<a href="system.php">', '</a>');
$section->addInput(new Form_Checkbox(
'use_caps',