mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-02 00:32:09 +02:00
cache astext to reduce number of dns queries
git-svn-id: http://www.observium.org/svn/observer/trunk@654 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+12
-4
@@ -733,7 +733,7 @@ function discover_process_ipv6($ifIndex,$ipv6_address,$ipv6_prefixlen,$ipv6_orig
|
|||||||
|
|
||||||
function get_astext($asn)
|
function get_astext($asn)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config,$cache;
|
||||||
|
|
||||||
if (isset($config['astext'][$asn]))
|
if (isset($config['astext'][$asn]))
|
||||||
{
|
{
|
||||||
@@ -741,9 +741,17 @@ function get_astext($asn)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$result = dns_get_record("AS$asn.asn.cymru.com",DNS_TXT);
|
if (isset($cache['astext'][$asn]))
|
||||||
$txt = explode('|',$result[0]['txt']);
|
{
|
||||||
return trim(str_replace('"', '', $txt[4]));
|
return $cache['astext'][$asn];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result = dns_get_record("AS$asn.asn.cymru.com",DNS_TXT);
|
||||||
|
$txt = explode('|',$result[0]['txt']);
|
||||||
|
$cache['astext'][$asn] = $txt[4];
|
||||||
|
return trim(str_replace('"', '', $txt[4]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user