diff options
author | Robbert Rijkse <robbert@rijkse.me> | 2017-05-09 19:52:13 -0400 |
---|---|---|
committer | Robbert Rijkse <robbert@rijkse.me> | 2017-05-09 19:52:13 -0400 |
commit | 49d9b45f92b67757555e84fa199f623f4165b962 (patch) | |
tree | 9f091aec3a10bc86dcbcce13a380543ff3cbcecb /src/etc/inc/unbound.inc | |
parent | 409165fde88e11eb057173c5d223eedc79d8d13c (diff) | |
download | pfsense-49d9b45f92b67757555e84fa199f623f4165b962.zip pfsense-49d9b45f92b67757555e84fa199f623f4165b962.tar.gz |
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.
Diffstat (limited to 'src/etc/inc/unbound.inc')
-rw-r--r-- | src/etc/inc/unbound.inc | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/etc/inc/unbound.inc b/src/etc/inc/unbound.inc index 6185f63..428a523 100644 --- a/src/etc/inc/unbound.inc +++ b/src/etc/inc/unbound.inc @@ -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; - } + $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"; + if (!$added_ptr[$host['ipaddr']]) { + $unbound_entries .= "local-data-ptr: \"{$host['ipaddr']} {$host['fqdn']}\"\n"; + $added_ptr[$host['ipaddr']] = true; } - } - 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."; + $unbound_entries .= "local-data: \"{$host['fqdn']} {$type} {$host['ipaddr']}\"\n"; } // Write out entries |