From 6c21524dd28774dda03ecdee1fb25858bfb3d449 Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Sun, 21 Aug 2011 21:37:35 +0200 Subject: For some reason global variable was not been obeyed in eval(), so reworked logic for v6 installs. Also pkg was been started twice by rc.start_packages. --- config/unbound/unbound.inc | 25 ++++++++++++------------- pkg_config.8.xml | 2 +- pkg_config.8.xml.amd64 | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc index 7931f593..f622bd71 100644 --- a/config/unbound/unbound.inc +++ b/config/unbound/unbound.inc @@ -35,9 +35,6 @@ if(!function_exists("get_nameservers")) if(!function_exists("gen_subnetv6") || !function_exists("gen_subnet")) require_once("util.inc"); -if(function_exists("is_ipaddrv6")) - $do_ipv6 = true; - function unbound_initial_setup() { global $config, $g; @@ -190,6 +187,7 @@ function unbound_control($action) { unbound_ctl_exec("forward $dns_servers"); } else { unbound_control("start"); + sleep(1); unbound_control("forward"); } } @@ -198,9 +196,9 @@ function unbound_control($action) { case "start": //Start unbound if($unbound_config['unbound_status'] == "on") { - unbound_ctl_exec("start"); + if(!is_service_running("unbound")) + unbound_ctl_exec("start"); fetch_root_hints(); - sleep(1); } break; @@ -224,7 +222,7 @@ function unbound_control($action) { case "restore_cache": //Restore Unbound's Cache - if($unbound_config['dumpcache'] == "on") { + if ((is_service_running("unbound")) && ($unbound_config['dumpcache'] == "on")) { if(file_exists($cache_dumpfile) && filesize($cache_dumpfile) > 0) unbound_ctl_exec("load_cache < /var/tmp/unbound_cache"); } @@ -241,7 +239,7 @@ function unbound_control($action) { } function unbound_get_network_interface_addresses() { - global $config, $do_ipv6; + global $config; $interfaces = $config['interfaces']; $unbound_config = $config['installedpackages']['unbound']['config'][0]; @@ -282,7 +280,7 @@ function unbound_get_network_interface_addresses() { } /* Configure IPv6 addresses */ - if($do_ipv6 == true) { + if(function_exists("is_ipaddrv6")) { if(is_ipaddrv6($interfaces[$unboundif]['ipaddrv6'])) { $unbound_interfaces[$i]['ipv6']['ipaddr'] = $interfaces[$unboundif]['ipaddrv6']; $unbound_interfaces[$i]['ipv6']['subnet'] = $interfaces[$unboundif]['subnetv6']; @@ -292,7 +290,7 @@ function unbound_get_network_interface_addresses() { /* Lastly check for loopback addresses*/ if($unboundif == "lo0") { $unbound_interfaces[$i]['loopback']['ipaddr'] = "127.0.0.1"; - if ($do_ipv6 == true) + if (function_exists("is_ipaddrv6")) $unbound_interfaces[$i]['loopback6']['ipaddr'] = "::1"; } $i++; @@ -719,10 +717,11 @@ function read_hosts() { return $etc_hosts; } -/* Setup /etc/hosts entries by overriding with local-data +/* + * Setup /etc/hosts entries by overriding with local-data */ function unbound_add_host_entries() { - global $config, $do_ipv6; + global $config; /* XXX: break this out into a separate config file and make use of include */ $unboundcfg = $config['installedpackages']['unbound']['config'][0]; @@ -735,7 +734,7 @@ function unbound_add_host_entries() { $unbound_entries .= "local-data: \"localhost A 127.0.0.1\"\n"; $unbound_entries .= "local-data: \"localhost.{$syscfg['domain']} A 127.0.0.1\"\n"; // IPv6 entries - if($do_ipv6 == true) { + if(function_exists("is_ipaddrv6")) { $unbound_entries .= "local-data-ptr: \"::1 localhost\"\n"; $unbound_entries .= "local-data: \"localhost AAAA ::1\"\n"; $unbound_entries .= "local-data: \"localhost.{$syscfg['domain']} AAAA ::1\"\n"; @@ -772,7 +771,7 @@ function unbound_add_host_entries() { $current_host = $host['host']; if(!$added_item[$current_host]) { $host_entries .= "local-data-ptr: \"{$host['ip']} {$host['host']}.{$host['domain']}\"\n"; - if($do_ipv6 == true) { + if(function_exists("is_ipaddrv6")) { if (is_ipaddrv6($host['ip'])) $host_entries .= "local-data: \"{$host['host']}.{$host['domain']} IN AAAA {$host['ip']}\"\n"; else diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 78a06924..c30fa21f 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -1047,7 +1047,7 @@ Unbound is a validating, recursive, and caching DNS resolver. This package is a drop in replacement for Services: DNS Forwarder and also supports DNSSEC extensions. Once installed please configure the Unbound service by visiting Services: Unbound DNS. http://www.unbound.net/ Services - 1.4.12_02 + 1.4.12_03 Alpha warren@decoy.co.za 2.0 diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 73d91dca..24e68686 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -1032,7 +1032,7 @@ Unbound is a validating, recursive, and caching DNS resolver. This package is a drop in replacement for Services: DNS Forwarder and also supports DNSSEC extensions. Once installed please configure the Unbound service by visiting Services: Unbound DNS. http://www.unbound.net/ Services - 1.4.12_02 + 1.4.12_03 Alpha warren@decoy.co.za 2.0 -- cgit v1.2.3