Skip to content

Commit

Permalink
Extra VLAN mapping in bridge FDB module to fix HP ProCurve (#11230)
Browse files Browse the repository at this point in the history
* Extra mapping for dot1qVlanFdbId to allow FDB VLANs to work on ProCurve
* Test data from joseUPV for ProCurve FDB VLANs
  • Loading branch information
PipoCanaja committed Mar 5, 2020
1 parent c059225 commit 5628b60
Show file tree
Hide file tree
Showing 3 changed files with 16,684 additions and 4 deletions.
25 changes: 21 additions & 4 deletions includes/discovery/fdb-table/bridge.inc.php
Expand Up @@ -19,12 +19,11 @@
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Tony Murray
* @copyright 2017 Tony Murray
* @copyright LibreNMS contributors
* @author Tony Murray <murraytony@gmail.com>
* @author cjwbath
*/


// Try Q-BRIDGE-MIB::dot1qTpFdbPort first
$fdbPort_table = snmpwalk_group($device, 'dot1qTpFdbPort', 'Q-BRIDGE-MIB');
if (!empty($fdbPort_table)) {
Expand All @@ -48,9 +47,27 @@
$port = get_port_by_index_cache($device['device_id'], $data['dot1dBasePortIfIndex']);
$portid_dict[$portLocal] = $port['port_id'];
}

// Build VLAN fdb index to real VLAN ID dictionary
$vlan_cur_table = snmpwalk_group($device, 'dot1qVlanFdbId', 'Q-BRIDGE-MIB', 2);
$vlan_fdb_dict = array();

// Indexed first by dot1qVlanTimeMark, which we ignore
foreach ($vlan_cur_table as $dot1qVlanTimeMark => $a) {
// Then by VLAN ID mapped to a single member array with the dot1qVlanFdbId
foreach ($a as $vid => $data) {
// Flip it round into the dictionary
$vlan_fdb_dict[$data['dot1qVlanFdbId']] = $vid;
}
}

// Collect data and populate $insert
foreach ($fdbPort_table as $vlan => $data) {
foreach ($fdbPort_table as $vlanIndex => $data) {
// Look the dot1qVlanFdbId up to a real VLAN number; if undefined assume the
// index *is* the VLAN number. Code in fdb-table.inc.php to map to the
// device VLANs table should catch anything invalid.
$vlan = isset($vlan_fdb_dict[$vlanIndex]) ? $vlan_fdb_dict[$vlanIndex] : $vlanIndex;

foreach ($data[$data_oid] as $mac => $dot1dBasePort) {
if ($dot1dBasePort == 0) {
d_echo("No port known for $mac\n");
Expand Down

0 comments on commit 5628b60

Please sign in to comment.