Skip to content

Commit 0fc5f34

Browse files
authored
Fix an issue in PortsStack module (librenms#17774)
Some devices only return ifIndex incorrectly for this table
1 parent ef58956 commit 0fc5f34

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

LibreNMS/Modules/PortsStack.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use App\Models\Device;
3131
use App\Models\PortStack;
3232
use App\Observers\ModuleModelObserver;
33+
use Illuminate\Support\Facades\Log;
3334
use LibreNMS\DB\SyncsModels;
3435
use LibreNMS\Interfaces\Data\DataStorageInterface;
3536
use LibreNMS\Interfaces\Module;
@@ -75,7 +76,13 @@ public function discover(OS $os): void
7576
return;
7677
}
7778

78-
$portStacks = $data->mapTable(function ($data, $lowIfIndex, $highIfIndex) use ($os) {
79+
$portStacks = $data->mapTable(function ($data, $lowIfIndex, $highIfIndex = null) use ($os) {
80+
if ($highIfIndex === null) {
81+
Log::debug('Skipping ' . $lowIfIndex . ' due to bad table index from the device');
82+
83+
return null;
84+
}
85+
7986
if ($lowIfIndex == '0' || $highIfIndex == '0') {
8087
return null; // we don't care about the default entries for ports that have stacking enabled
8188
}

0 commit comments

Comments
 (0)