Commit 5aac90e8 authored by Franco Fichtner's avatar Franco Fichtner

Merge pull request #625 from 8191/fix_unbound-regdhcp

unbound: Fix "register DHCP leases in DNS" config option
parents 7c1a2858 4f116228
......@@ -557,18 +557,20 @@ function unbound_add_host_entries() {
}
// Handle DHCPLeases added host entries
$dhcplcfg = read_hosts();
$host_entries = "";
if (is_array($dhcplcfg)) {
foreach($dhcplcfg as $key=>$host) {
$host_entries .= "local-data-ptr: \"{$host['ipaddr']} {$host['fqdn']}\"\n";
$host_entries .= "local-data: \"{$host['fqdn']} IN A {$host['ipaddr']}\"\n";
if (!empty($host['name'])) {
$host_entries .= "local-data-ptr: \"{$host['ipaddr']} {$host['name']}\"\n";
$host_entries .= "local-data: \"{$host['name']} IN A {$host['ipaddr']}\"\n";
if (isset($config['unbound']['regdhcp'])) {
$dhcplcfg = read_hosts();
$host_entries = "";
if (is_array($dhcplcfg)) {
foreach($dhcplcfg as $key=>$host) {
$host_entries .= "local-data-ptr: \"{$host['ipaddr']} {$host['fqdn']}\"\n";
$host_entries .= "local-data: \"{$host['fqdn']} IN A {$host['ipaddr']}\"\n";
if (!empty($host['name'])) {
$host_entries .= "local-data-ptr: \"{$host['ipaddr']} {$host['name']}\"\n";
$host_entries .= "local-data: \"{$host['name']} IN A {$host['ipaddr']}\"\n";
}
}
$unbound_entries .= $host_entries;
}
$unbound_entries .= $host_entries;
}
// Write out entries
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment