From 45d8325e97cac585c8db3fec1c20b110f27af8f5 Mon Sep 17 00:00:00 2001 From: Paul Gear Date: Mon, 28 Apr 2014 20:10:36 +1000 Subject: [PATCH] Revert "Merge pull request #160 from laf/issue-159" This reverts commit 59dfe4eee24630649a1b96b82cb55fb29e07a0b0, reversing changes made to e6fa7d433d497abd0ffa56090eafda4630c96442. This commit does not constitute agreement with the claim of copyright violation made by Adam Armstrong at https://github.com/librenms/librenms/commit/59dfe4eee24630649a1b96b82cb55fb29e07a0b0 --- includes/discovery/vlans.inc.php | 17 ++--------------- includes/snmp.inc.php | 18 +----------------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/includes/discovery/vlans.inc.php b/includes/discovery/vlans.inc.php index 3eaec69f1b..4d32f510c9 100644 --- a/includes/discovery/vlans.inc.php +++ b/includes/discovery/vlans.inc.php @@ -31,22 +31,9 @@ foreach ($device['vlans'] as $domain_id => $vlans) if ($device['os_group'] == "cisco" || $device['os'] == "ios") // This shit only seems to work on IOS { # Probably does not work with snmpv3. I have no real idea about what this code is really doing - $device_details = $device; - $device_details['snmpcontext'] = $vlan_id; $vlan_device = array_merge($device, array('community' => $device['community']."@".$vlan_id)); - $vlan_data = snmpwalk_cache_oid($device_details, "dot1dStpPortEntry", array(), "BRIDGE-MIB:Q-BRIDGE-MIB"); - if ($exec_response['status'] != 0) - { - unset($device_details); - if( $device['snmpver'] == 'v3') - { - print_error("ERROR: For 'vlan-' context to work correctly on cisco device with SNMPv3, please add 'match prefix' into snmp config."); - } else { - print_error("ERROR: No support for per-VLAN community"); - } - break; - } - $vlan_data = snmpwalk_cache_oid($device_details, "dot1dBasePortEntry", $vlan_data, "BRIDGE-MIB:Q-BRIDGE-MIB"); + $vlan_data = snmpwalk_cache_oid($vlan_device, "dot1dStpPortEntry", array(), "BRIDGE-MIB:Q-BRIDGE-MIB"); + $vlan_data = snmpwalk_cache_oid($vlan_device, "dot1dBasePortEntry", $vlan_data, "BRIDGE-MIB:Q-BRIDGE-MIB"); } echo("VLAN $vlan_id \n"); diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php index ada175c39d..c5d0117a68 100644 --- a/includes/snmp.inc.php +++ b/includes/snmp.inc.php @@ -765,28 +765,12 @@ function snmp_cache_portName($device, $array) function snmp_gen_auth (&$device) { global $debug; - $vlan = FALSE; - - if (isset($device['snmpcontext'])) - { - if (is_numeric($device['snmpcontext']) && $device['snmpcontext'] > 0 && $device['snmpcontext'] < 4096 ) - { - $vlan = $device['snmpcontext']; - } - } $cmd = ""; if ($device['snmpver'] === "v3") { - $cmd = " -v3 -l " . $device['authlevel']; - - if(is_numeric($vlan)) - { - $cmd .= ' -n "vlan-' . $vlan . '"'; - } else { - $cmd .= ' -n ""'; - } + $cmd = " -v3 -n \"\" -l " . $device['authlevel']; if ($device['authlevel'] === "noAuthNoPriv") {