From be5aa310862b4460beed35d8e95ea068630ff313 Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Thu, 20 Mar 2014 21:57:37 +0200 Subject: [PATCH] Rather put forwarding for DNS servers into the configuration file --- etc/inc/unbound.inc | 62 ++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/etc/inc/unbound.inc b/etc/inc/unbound.inc index 2015066c49..6bc5a561f0 100644 --- a/etc/inc/unbound.inc +++ b/etc/inc/unbound.inc @@ -172,6 +172,35 @@ EOF; $unwanted_reply_threshold = (!empty($config['unbound']['unwanted_reply_threshold'])) ? $config['unbound']['unwanted_reply_threshold'] : "0"; $verbosity = isset($config['unbound']['loglevel']) ? $config['unbound']['loglevel'] : 1; + // Set up forwarding if it configured + if (isset($config['unbound']['forwarding'])) { + $dnsservers = array(); + if (isset($config['system']['dnsallowoverride'])) { + $ns = array_unique(get_nameservers()); + foreach($ns as $nameserver) { + if ($nameserver) + $dnsservers[] = $nameserver; + } + } else { + $ns = array_unique(get_dns_servers()); + foreach($ns as $nameserver) { + if ($nameserver) + $dnsservers[] = $nameserver; + } + } + + if (!empty($dnsservers)) { + $forward_conf .=<<