From 0dca6edd3433b616bee3ef33a487e3794ddf84cb Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 5 Aug 2016 12:41:50 +0200 Subject: [PATCH] unbound: also pick up link-local IPv6 and remove localhost The other code does more or less the same, but it seems that a lot needs to be cleaned up still... PR: https://forum.opnsense.org/index.php?topic=3311.0 --- src/etc/inc/system.inc | 10 ++++++---- src/etc/inc/unbound.inc | 5 +++++ src/www/services_unbound.php | 6 ++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index e600835bc..6eba26338 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -1772,7 +1772,7 @@ function system_arp_wrong_if() )); } -function get_possible_listen_ips($include_ipv6_link_local=false) { +function get_possible_listen_ips($include_ipv6_link_local = false, $include_loopback = true) { $interfaces = get_configured_interface_with_descr(); $carplist = get_configured_carp_interface_list(); $listenips = array(); @@ -1796,9 +1796,11 @@ function get_possible_listen_ips($include_ipv6_link_local=false) { } } } - $tmp["name"] = "Localhost"; - $tmp["value"] = "lo0"; - $listenips[] = $tmp; + if ($include_loopback) { + $tmp["name"] = "Localhost"; + $tmp["value"] = "lo0"; + $listenips[] = $tmp; + } return $listenips; } diff --git a/src/etc/inc/unbound.inc b/src/etc/inc/unbound.inc index 6e8603a38..5686f3340 100644 --- a/src/etc/inc/unbound.inc +++ b/src/etc/inc/unbound.inc @@ -556,6 +556,11 @@ function unbound_add_host_entries() $unbound_entries .= "local-data: \"{$config['system']['hostname']}.{$config['system']['domain']} AAAA {$laddr6}\"\n"; $unbound_entries .= "local-data: \"{$config['system']['hostname']} AAAA {$laddr6}\"\n"; } + $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"; + } } } diff --git a/src/www/services_unbound.php b/src/www/services_unbound.php index 9b7049c90..ad7250542 100644 --- a/src/www/services_unbound.php +++ b/src/www/services_unbound.php @@ -172,10 +172,8 @@ include_once("head.inc");