don't discover ports that shouldn't be discovered!

git-svn-id: http://www.observium.org/svn/observer/trunk@2347 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-05-18 23:08:45 +00:00
parent a1348cb7bb
commit 5033e81e87
3 changed files with 76 additions and 63 deletions

View File

@@ -582,4 +582,42 @@ function include_dir($dir, $regex = "")
}
}
function is_port_valid($port, $device)
{
global $config;
if (!strstr($port['ifDescr'], "irtual"))
{
$valid = 1;
$if = strtolower($port['ifDescr']);
foreach ($config['bad_if'] as $bi)
{
if (strstr($if, $bi))
{
$valid = 0;
if($debug) { echo("ignored : $bi : $if"); }
}
}
if (is_array($config['bad_if_regexp']))
{
foreach ($config['bad_if_regexp'] as $bi)
{
if (preg_match($bi ."i", $if))
{
$valid = 0;
if($debug) { echo("ignored : $bi : ".$if); }
}
}
}
if (empty($port['ifDescr'])) { $valid = 0; }
if ($device['os'] == "catos" && strstr($if, "vlan")) { $valid = 0; }
} else {
$valid = 0;
}
return $valid;
}
?>