From 76bf3f54b40cd7366ad48c9a3a79fe1eb953a687 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Sat, 9 Jan 2010 17:06:34 +0000 Subject: [PATCH] allow for custom ASN textual descriptions git-svn-id: http://www.observium.org/svn/observer/trunk@637 61d68cd4-352d-0410-923a-c4978735b2b8 --- config.php.default | 4 ++++ includes/functions.php | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/config.php.default b/config.php.default index 88c06b69b..2068b709f 100755 --- a/config.php.default +++ b/config.php.default @@ -133,6 +133,10 @@ $config['ignore_mount'] = array("/kern", "/mnt/cdrom", "/dev", "/dev/pts", "/pro $config['ignore_mount_regexp'] = array(); $config['ignore_mount_string'] = array("/.*\/dev\/?$/"); +### Hardcoded ASN descriptions + +# $config['astext'][65333] = "Cymru Bogon Feed"; + ### Style Options $list_colour_a = "#ffffff"; diff --git a/includes/functions.php b/includes/functions.php index 7bfeffd40..800f81851 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -733,9 +733,18 @@ function discover_process_ipv6($ifIndex,$ipv6_address,$ipv6_prefixlen,$ipv6_orig function get_astext($asn) { - $result = dns_get_record("AS$asn.asn.cymru.com",DNS_TXT); - $txt = explode('|',$result[0]['txt']); - return trim(str_replace('"', '', $txt[4])); + global $config; + + if (isset($config['astext'][$asn])) + { + return $config['astext'][$asn]; + } + else + { + $result = dns_get_record("AS$asn.asn.cymru.com",DNS_TXT); + $txt = explode('|',$result[0]['txt']); + return trim(str_replace('"', '', $txt[4])); + } } function eventlog($eventtext,$device_id = "", $interface_id = "")