diff options
-rw-r--r-- | config/haproxy-devel/pkg/haproxy_utils.inc | 41 | ||||
-rw-r--r-- | pkg_config.10.xml | 2 |
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> |