From 34a17ee5377b40dd281d70032124cfae90b8b38c Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Thu, 22 Apr 2010 23:22:11 +0000 Subject: [PATCH] implement bad_if_regexp regular expression filter for port ifDescr (clean and allow for portName and ifName too?) (thanks thevoke!) git-svn-id: http://www.observium.org/svn/observer/trunk@1069 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/discovery/ports.inc.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/includes/discovery/ports.inc.php b/includes/discovery/ports.inc.php index 951930e66b..ca4255d9ea 100755 --- a/includes/discovery/ports.inc.php +++ b/includes/discovery/ports.inc.php @@ -22,6 +22,14 @@ $if = trim(strtolower($ifDescr)); $nullintf = 0; foreach($config['bad_if'] as $bi) { if (strstr($if, $bi)) { $nullintf = 1; } } + if(is_array($config['bad_if_regexp'])) { + foreach($config['bad_if_regexp'] as $bi) { + if (preg_match($bi ."i", $if)) { + $nullintf = 1; + } + } + } + if($device['os'] == "catos" && strstr($if, "vlan") ) { $nullintf = 1; } $ifDescr = fixifName($ifDescr); if (preg_match('/serial[0-9]:/', $if)) { $nullintf = 1; }