From 463b0753a615ba0c6605cf47b12de77243c969f0 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Wed, 30 Mar 2011 11:25:39 +0000 Subject: [PATCH] fix blocking dsl0 ports (sl0!) and tidied some other stuff up git-svn-id: http://www.observium.org/svn/observer/trunk@1993 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/defaults.inc.php | 4 ++-- includes/discovery/ports.inc.php | 17 ++++++++++------- includes/polling/ports.inc.php | 2 ++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 3438f7117..2ee6cedc3 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -154,13 +154,13 @@ $config['rancid_ignorecomments'] = 0; # Ignore lines starting with # ### Ignores & Allows -$config['bad_if'] = array("voip-null", "virtual-", "unrouted", "eobc", "mpls", "sl0", "lp0", "faith0", +$config['bad_if'] = array("voip-null", "virtual-", "unrouted", "eobc", "mpls", "lp0", "faith0", "-atm layer", "-atm subif", "-shdsl", "-aal5", "-atm", "container", "async", "plip", "-physical", "-signalling", "container", "unrouted", "bri", "-bearer", "bluetooth", "isatap", "ras", "qos", "miniport", "sonet/sdh", "span rp", "span sp", "sslvpn"); -$config['bad_if_regexp'] = array("/serial[0-9]:/"); +$config['bad_if_regexp'] = array("/serial[0-9]:/", "/^ng[0-9]+$/", "/^sl[0-9]/"); $config['processor_filter'][] = "An electronic chip that makes the computer work."; diff --git a/includes/discovery/ports.inc.php b/includes/discovery/ports.inc.php index 0da4b84f3..e0e2b5e58 100755 --- a/includes/discovery/ports.inc.php +++ b/includes/discovery/ports.inc.php @@ -21,7 +21,14 @@ foreach (explode("\n", $ports) as $entry) { $if = trim(strtolower($ifDescr)); $nullintf = 0; - foreach ($config['bad_if'] as $bi) { if (strstr($if, $bi)) { $nullintf = 1; } } + foreach ($config['bad_if'] as $bi) + { + if (strstr($if, $bi)) + { + $nullintf = 1; + if($debug) { echo("ignored : $bi : $if"); } + } + } if (is_array($config['bad_if_regexp'])) { foreach ($config['bad_if_regexp'] as $bi) @@ -29,6 +36,7 @@ foreach (explode("\n", $ports) as $entry) if (preg_match($bi ."i", $if)) { $nullintf = 1; + if($debug) { echo("ignored : $bi : $if"); } } } } @@ -37,11 +45,6 @@ foreach (explode("\n", $ports) as $entry) if ($device['os'] == "catos" && strstr($if, "vlan")) { $nullintf = 1; } if ($device['os'] == "vmware" && preg_match("/Device ([a-z0-9]+) at .*/", $ifDescr, $matches)) { $ifDescr = $matches[1]; } $ifDescr = fixifName($ifDescr); - if (preg_match('/serial[0-9]:/', $if)) { $nullintf = 1; } - if (isset($config['allow_ng']) && !$config['allow_ng']) - { - if (preg_match('/ng[0-9]+$/', $if)) { $nullintf = 1; } - } if ($debug) echo("\n $if "); if ($nullintf == 0) { @@ -90,4 +93,4 @@ while ($test_if = mysql_fetch_array($query)) unset($temp_exists); echo("\n"); -?> \ No newline at end of file +?> diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index 89b907537..e6b6ad15d 100755 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -46,6 +46,8 @@ if ($config['enable_ports_adsl']) $device['adsl_count'] = mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."' AND `ifType` = 'adsl'"),0); } + + if ($device['adsl_count'] > "0") { echo("ADSL ");