From e617de347a3bc1cdd01f1db3fabfb7462eb81417 Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Thu, 18 Nov 2010 19:00:50 +0200 Subject: Bump version number and correctly handle domain overrides including the ability to have duplicate domain override entries. --- config/unbound/unbound.inc | 27 +++++++++++++++++---------- pkg_config.8.xml | 2 +- pkg_config.8.xml.amd64 | 2 +- 3 files changed, 19 insertions(+), 12 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; diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 0f124456..4e3b6199 100755 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -945,7 +945,7 @@ Unbound is a validating, recursive, and caching DNS resolver. http://www.unbound.net/ Services - 1.0 + 1.1 Alpha 2.0 http://doc.pfsense.org/index.php/Unbound_package diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index c44ce010..7cbf64b2 100755 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -961,7 +961,7 @@ Unbound is a validating, recursive, and caching DNS resolver. http://www.unbound.net/ Services - 1.0 + 1.1 Alpha 2.0 http://doc.pfsense.org/index.php/Unbound_package -- cgit v1.2.3