aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarren Baker <warren@decoy.co.za>2014-02-23 20:10:45 +0200
committerWarren Baker <warren@decoy.co.za>2014-02-23 20:10:45 +0200
commit09b882f22f8456f50242febe3f16f2fa9bd7d591 (patch)
treebe0c55b459478ad61b6a94a74dd9c67541c2c75e
parente1df5bd9a2bcdffb85f74a4f80355b2e88027889 (diff)
downloadpfsense-packages-09b882f22f8456f50242febe3f16f2fa9bd7d591.tar.gz
pfsense-packages-09b882f22f8456f50242febe3f16f2fa9bd7d591.tar.bz2
pfsense-packages-09b882f22f8456f50242febe3f16f2fa9bd7d591.zip
Add a safety belt in case we get no values returned
-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";
+ }
}