aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorWarren Baker <warren@decoy.co.za>2010-11-18 19:00:50 +0200
committerWarren Baker <warren@decoy.co.za>2010-11-18 19:00:50 +0200
commite617de347a3bc1cdd01f1db3fabfb7462eb81417 (patch)
tree7524813af505c5cb1a22ff429f4d88463cff03b8 /config
parent1d892d512b47b716f64fc6a95ecf718e65e0026c (diff)
downloadpfsense-packages-e617de347a3bc1cdd01f1db3fabfb7462eb81417.tar.gz
pfsense-packages-e617de347a3bc1cdd01f1db3fabfb7462eb81417.tar.bz2
pfsense-packages-e617de347a3bc1cdd01f1db3fabfb7462eb81417.zip
Bump version number and correctly handle domain overrides including the ability to have duplicate domain override entries.
Diffstat (limited to 'config')
-rw-r--r--config/unbound/unbound.inc27
1 files changed, 17 insertions, 10 deletions
diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc
index 120bc01b..3d4bc529 100644
--- a/config/unbound/unbound.inc
+++ b/config/unbound/unbound.inc
@@ -418,17 +418,24 @@ function unbound_add_domain_overrides() {
if (isset($config['dnsmasq']['domainoverrides'])) {
$domains = $config['dnsmasq']['domainoverrides'];
+
+ // Domain overrides that have multiple entries need multiple forward-addr: added
+ $sorted_domains = msort($domains, "domain");
+ $result = array();
+ foreach($sorted_domains as $domain) {
+ $domain_key = current($domain);
+ if(!isset($result[$domain_key])) {
+ $result[$domain_key] = array();
+ }
+ $result[$domain_key][] = $domain['ip'];
+ }
+
$domain_entries = "";
- $added_item = array();
- foreach($domains as $domain) {
- $current_domain = $domain['domain'];
- if(!$added_item[$current_domain]) {
- $domain_entries .= "local-zone: '{$domain['domain']}.' redirect\n";
- $domain_entries .= "local-data: '{$domain['domain']}. A {$domain['ip']}'\n";
- if (!empty($domain['descr']))
- $domain_entries .= "local-data: '{$domain['domain']}. TXT \"{$domain['descr']}\"'\n";
- // Do not add duplicate entries
- $added_item[$current_domain] = true;
+ foreach($result as $domain=>$ips) {
+ $domain_entries .= "forward-zone:\n";
+ $domain_entries .= "\tname: \"$domain\"\n";
+ foreach($ips as $ip) {
+ $domain_entries .= "\tforward-addr: $ip\n";
}
}
return $domain_entries;