#729 Discovery partially fails on invalid indexes

This commit is contained in:
Oliver Gorwits
2020-06-29 14:05:44 +01:00
parent 8ff595c321
commit 83de59fcc0
3 changed files with 22 additions and 0 deletions

View File

@@ -102,13 +102,21 @@ register_worker({ phase => 'main', driver => 'snmp' }, sub {
}
foreach my $idx (keys %$interfaces) {
next unless defined $idx;
my $port = $interfaces->{$idx} or next;
if (!defined $device_ports->{$port}) {
debug sprintf ' [%s] properties/ifindex - local port %s already skipped, ignoring',
$device->ip, $port;
next;
}
if ($idx !~ m/^[0-9]+$/) {
debug sprintf ' [%s] properties/ifindex - port %s ifindex %s is not an integer',
$device->ip, $port, $idx;
next;
}
$properties{ $port }->{ifindex} = $idx;
}