mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 18:38:25 +00:00
Check dot1dBasePortIfIndex exists before using it (#14337)
* Check dot1dBasePortIfIndex exists before using it Fixes: array_flip(): Can only flip STRING and INTEGER values! * Update vlans.inc.php * Update vlans.inc.php
This commit is contained in:
parent
881d581448
commit
a5b1ef61bc
@ -22,6 +22,11 @@ $base_to_index = [];
|
||||
$tmp_base_indexes = snmpwalk_cache_oid($device, 'dot1dBasePortIfIndex', [], 'BRIDGE-MIB');
|
||||
// flatten the array
|
||||
foreach ($tmp_base_indexes as $index => $array) {
|
||||
// Broken SNMP servers can return the wrong data when OID doesn't exist
|
||||
// So lets sanity check
|
||||
if (! array_key_exists('dot1dBasePortIfIndex', $array)) {
|
||||
continue;
|
||||
}
|
||||
$base_to_index[$index] = $array['dot1dBasePortIfIndex'];
|
||||
}
|
||||
$index_to_base = array_flip($base_to_index);
|
||||
|
Loading…
Reference in New Issue
Block a user