Commit 4f116228 authored by Manuel Faux's avatar Manuel Faux

unbound: Fix "register DHCP leases in DNS" config option

The option to register DHCP leases within unbound DNS was configurable via
DNS Resolver GUI, but the setting was ignored. DHCP leases were always applied.
parent 3724aecb
...@@ -549,18 +549,20 @@ function unbound_add_host_entries() { ...@@ -549,18 +549,20 @@ function unbound_add_host_entries() {
} }
// Handle DHCPLeases added host entries // Handle DHCPLeases added host entries
$dhcplcfg = read_hosts(); if (isset($config['unbound']['regdhcp'])) {
$host_entries = ""; $dhcplcfg = read_hosts();
if (is_array($dhcplcfg)) { $host_entries = "";
foreach($dhcplcfg as $key=>$host) { if (is_array($dhcplcfg)) {
$host_entries .= "local-data-ptr: \"{$host['ipaddr']} {$host['fqdn']}\"\n"; foreach($dhcplcfg as $key=>$host) {
$host_entries .= "local-data: \"{$host['fqdn']} IN A {$host['ipaddr']}\"\n"; $host_entries .= "local-data-ptr: \"{$host['ipaddr']} {$host['fqdn']}\"\n";
if (!empty($host['name'])) { $host_entries .= "local-data: \"{$host['fqdn']} IN A {$host['ipaddr']}\"\n";
$host_entries .= "local-data-ptr: \"{$host['ipaddr']} {$host['name']}\"\n"; if (!empty($host['name'])) {
$host_entries .= "local-data: \"{$host['name']} IN A {$host['ipaddr']}\"\n"; $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 // 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