aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiBa-NL <pba_2k3@yahoo.com>2015-06-24 21:12:47 +0200
committerPiBa-NL <pba_2k3@yahoo.com>2015-06-24 21:16:53 +0200
commit8d74433d9b8da1fc508f03ad2eb27fd8ea3ba504 (patch)
tree683234e171bc77df91cc6ba4fd3882a968fc7308
parent51aa815ed0a53798ef56899daf5fd21bb8ceef81 (diff)
downloadpfsense-packages-8d74433d9b8da1fc508f03ad2eb27fd8ea3ba504.tar.gz
pfsense-packages-8d74433d9b8da1fc508f03ad2eb27fd8ea3ba504.tar.bz2
pfsense-packages-8d74433d9b8da1fc508f03ad2eb27fd8ea3ba504.zip
haproxy-devel, fix dns resolving dns_get_record does not properly resolve if not all requested types are present..
-rw-r--r--config/haproxy-devel/pkg/haproxy_utils.inc41
-rw-r--r--pkg_config.10.xml2
2 files changed, 24 insertions, 19 deletions
diff --git a/config/haproxy-devel/pkg/haproxy_utils.inc b/config/haproxy-devel/pkg/haproxy_utils.inc
index 3d841a25..ec72b986 100644
--- a/config/haproxy-devel/pkg/haproxy_utils.inc
+++ b/config/haproxy-devel/pkg/haproxy_utils.inc
@@ -39,32 +39,37 @@ class haproxy_utils {
public function query_dns($host, $querytype="A,AAAA") {
$result = array();
$types = explode(',',$querytype);
- $recordtypes = 0;
+ $recordtype = 0;
foreach($types as $type){
switch ($type) {
case 'A':
- $recordtypes += DNS_A;
+ $recordtype = DNS_A;
break;
case 'AAAA':
- $recordtypes += DNS_AAAA;
+ $recordtype = DNS_AAAA;
break;
}
- }
- if ($recordtypes == 0)
- return $result;
-
- $dnsresult = dns_get_record($host, $recordtypes);
- foreach($dnsresult as $item) {
- $newitem["typeid"] = $item['type'];
- switch ($item['type']) {
- case 'A':
- $newitem["data"] = $item['ip'];
- break;
- case 'AAAA':
- $newitem["data"] = $item['ipv6'];
- break;
+ if ($recordtype != 0) {
+ //query one type at a time, querying multiple types in one call dns_get_record fails if one is not present..
+ $errreporting = error_reporting();
+ error_reporting($errreporting & ~E_WARNING);// dns_get_record throws a warning if nothing is resolved..
+ $dnsresult = dns_get_record($host, $recordtype);
+ error_reporting($errreporting);
+ if (is_array($dnsresult)) {
+ foreach($dnsresult as $item) {
+ $newitem["typeid"] = $item['type'];
+ switch ($item['type']) {
+ case 'A':
+ $newitem["data"] = $item['ip'];
+ break;
+ case 'AAAA':
+ $newitem["data"] = $item['ipv6'];
+ break;
+ }
+ $result[] = $newitem;
+ }
+ }
}
- $result[] = $newitem;
}
return $result;
}
diff --git a/pkg_config.10.xml b/pkg_config.10.xml
index e43023ca..d545b51d 100644
--- a/pkg_config.10.xml
+++ b/pkg_config.10.xml
@@ -172,7 +172,7 @@
Supports ACLs for smart backend switching.]]></descr>
<website>http://haproxy.1wt.eu/</website>
<category>Services</category>
- <version>0.25</version>
+ <version>0.26</version>
<status>Release</status>
<required_version>2.2</required_version>
<config_file>https://packages.pfsense.org/packages/config/haproxy-devel/haproxy.xml</config_file>