diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2010-11-17 18:25:21 -0500 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2010-11-17 18:25:21 -0500 |
commit | f55bcabba944d8a9a86d2f9b206b6e5e557a0161 (patch) | |
tree | b83ec147b1e376994bb1ae9bb134fcdbd1009de9 /config/unbound/unbound.inc | |
parent | 2cd8e147bcf14f8885514344b77d0e3e6ff67066 (diff) | |
download | pfsense-packages-f55bcabba944d8a9a86d2f9b206b6e5e557a0161.tar.gz pfsense-packages-f55bcabba944d8a9a86d2f9b206b6e5e557a0161.tar.bz2 pfsense-packages-f55bcabba944d8a9a86d2f9b206b6e5e557a0161.zip |
Do not allow duplicates. Boost connect timeout.
Diffstat (limited to 'config/unbound/unbound.inc')
-rw-r--r-- | config/unbound/unbound.inc | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc index b4df2093..2068ae76 100644 --- a/config/unbound/unbound.inc +++ b/config/unbound/unbound.inc @@ -323,8 +323,8 @@ function fetch_root_hints() { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, '5'); + curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, '25'); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $data = curl_exec($ch); curl_close($ch); @@ -380,14 +380,19 @@ function unbound_uninstall() { */ function unbound_add_host_entries() { global $config; - + if (isset($config['dnsmasq']['hosts'])) { - $hosts = $config['dnsmasq']['hosts']; + $hosts = $config['dnsmasq']['hosts']; $host_entries = ""; - + $added_item = array(); foreach ($hosts as $host) { - $host_entries .= "local-data: '{$host['host']}.{$host['domain']}. IN A {$host['ip']}'\n"; - $host_entries .= "\tlocal-data: '{$host['host']}.{$host['domain']}. TXT \"{$host['descr']}\"'\n"; + $current_host = $host['host']; + if(!$added_item[$current_host]) { + $host_entries .= "\tlocal-data: '{$host['host']}.{$host['domain']}. IN A {$host['ip']}'\n"; + $host_entries .= "\tlocal-data: '{$host['host']}.{$host['domain']}. TXT \"{$host['descr']}\"'\n"; + // Do not add duplicate entries + $added_item[$current_host] = true; + } } return $host_entries; } @@ -397,16 +402,20 @@ function unbound_add_host_entries() { */ function unbound_add_domain_overrides() { global $config; - + if (isset($config['dnsmasq']['domainoverrides'])) { $domains = $config['dnsmasq']['domainoverrides']; $domain_entries = ""; - + $added_item = array(); foreach($domains as $domain) { - $domain_entries .= "local-zone: '{$domain['domain']}.' redirect\n"; - $domain_entries .= "\tlocal-data: '{$domain['domain']}. A {$domain['ip']}'\n"; - $domain_entries .= "\tlocal-data: '{$domain['domain']}. TXT \"{$domain['descr']}\"'\n"; - + $current_domain = $domain['domain']; + if(!$added_item[$current_domain]) { + $domain_entries .= "local-zone: '{$domain['domain']}.' redirect\n"; + $domain_entries .= "\tlocal-data: '{$domain['domain']}. A {$domain['ip']}'\n"; + $domain_entries .= "\tlocal-data: '{$domain['domain']}. TXT \"{$domain['descr']}\"'\n"; + // Do not add duplicate entries + $added_item[$current_domain] = true; + } } return $domain_entries; } |