unbound: register dhcp domain name for interface if found

PR: https://github.com/opnsense/core/issues/1940
This commit is contained in:
Franco Fichtner 2017-11-19 17:43:46 +01:00
parent 735f9b8770
commit 84bd7d8e30

View File

@ -541,25 +541,38 @@ function unbound_add_host_entries()
continue;
}
$if = get_real_interface($interface);
if (does_interface_exist($if)) {
$laddr = find_interface_ip($if);
if (is_ipaddrv4($laddr)) {
$unbound_entries .= "local-data-ptr: \"{$laddr} {$config['system']['hostname']}.{$config['system']['domain']}\"\n";
$unbound_entries .= "local-data: \"{$config['system']['hostname']}.{$config['system']['domain']} A {$laddr}\"\n";
$unbound_entries .= "local-data: \"{$config['system']['hostname']} A {$laddr}\"\n";
if (!does_interface_exist($if)) {
continue;
}
$laddr = find_interface_ip($if);
if (is_ipaddrv4($laddr)) {
$domain = $config['system']['domain'];
if (isset($config['dhcpd'][$interface]['enable']) && !empty($config['dhcpd'][$interface]['domain'])) {
$domain = $config['dhcpd'][$interface]['domain'];
}
$laddr6 = find_interface_ipv6($if);
if (is_ipaddrv6($laddr6)) {
$unbound_entries .= "local-data-ptr: \"{$laddr6} {$config['system']['hostname']}.{$config['system']['domain']}\"\n";
$unbound_entries .= "local-data: \"{$config['system']['hostname']}.{$config['system']['domain']} AAAA {$laddr6}\"\n";
$unbound_entries .= "local-data: \"{$config['system']['hostname']} AAAA {$laddr6}\"\n";
$unbound_entries .= "local-data-ptr: \"{$laddr} {$config['system']['hostname']}.{$domain}\"\n";
$unbound_entries .= "local-data: \"{$config['system']['hostname']}.{$domain} A {$laddr}\"\n";
$unbound_entries .= "local-data: \"{$config['system']['hostname']} A {$laddr}\"\n";
}
$laddr6 = find_interface_ipv6($if);
if (is_ipaddrv6($laddr6)) {
$domain = $config['system']['domain'];
if (isset($config['dhcpdv6'][$interface]['enable']) && !empty($config['dhcpdv6'][$interface]['domain'])) {
$domain = $config['dhcpdv6'][$interface]['domain'];
}
if (empty($config['unbound']['noreglladdr6'])) {
$lladdr6 = find_interface_ipv6_ll($if);
if (is_ipaddrv6($lladdr6)) {
$unbound_entries .= "local-data: \"{$config['system']['hostname']}.{$config['system']['domain']} AAAA {$lladdr6}\"\n";
$unbound_entries .= "local-data: \"{$config['system']['hostname']} AAAA {$lladdr6}\"\n";
$unbound_entries .= "local-data-ptr: \"{$laddr6} {$config['system']['hostname']}.{$domain}\"\n";
$unbound_entries .= "local-data: \"{$config['system']['hostname']}.{$domain} AAAA {$laddr6}\"\n";
$unbound_entries .= "local-data: \"{$config['system']['hostname']} AAAA {$laddr6}\"\n";
}
if (empty($config['unbound']['noreglladdr6'])) {
$lladdr6 = find_interface_ipv6_ll($if);
if (is_ipaddrv6($lladdr6)) {
$domain = $config['system']['domain'];
if (isset($config['dhcpdv6'][$interface]['enable']) && !empty($config['dhcpdv6'][$interface]['domain'])) {
$domain = $config['dhcpdv6'][$interface]['domain'];
}
$unbound_entries .= "local-data: \"{$config['system']['hostname']}.{$domain} AAAA {$lladdr6}\"\n";
$unbound_entries .= "local-data: \"{$config['system']['hostname']} AAAA {$lladdr6}\"\n";
}
}
}