aboutsummaryrefslogtreecommitdiffstats
path: root/config/unbound
diff options
context:
space:
mode:
Diffstat (limited to 'config/unbound')
-rw-r--r--config/unbound/unbound.inc15
1 files changed, 9 insertions, 6 deletions
diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc
index e82c6d64..fb077194 100644
--- a/config/unbound/unbound.inc
+++ b/config/unbound/unbound.inc
@@ -543,11 +543,6 @@ EOD;
// Set up forward-zones if configured
if ($unbound_config['forwarding_mode'] == "on") {
- $unbound_conf .=<<<EOD
-forward-zone:
- name: "."
-
-EOD;
$dnsservers = array();
if (!isset($config['system']['dnsallowoverride'])) {
$ns = array_unique(get_nameservers());
@@ -562,8 +557,16 @@ EOD;
$dnsservers[] = $nameserver;
}
}
- foreach($dnsservers as $dnsserver)
+
+ if (!empty($dnsservers)) {
+ $unbound_conf .=<<<EOD
+forward-zone:
+ name: "."
+
+EOD;
+ foreach($dnsservers as $dnsserver)
$unbound_conf .= "\tforward-addr: $dnsserver\n";
+ }
}