From f40693b503c3217a1aad779b804670037879ced1 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Mon, 23 May 2022 12:10:28 +0200 Subject: [PATCH] Workaround issues with lldp information from GS108Tv1 (#13971) The GS108Tv1 doesn't present the same information over snmp as they do over lldp. This tries to detect such a remote device and figure out which remote port we actually should map it to. --- includes/discovery/discovery-protocols.inc.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/discovery/discovery-protocols.inc.php b/includes/discovery/discovery-protocols.inc.php index ef1e7670cd..1f30bbe2b2 100644 --- a/includes/discovery/discovery-protocols.inc.php +++ b/includes/discovery/discovery-protocols.inc.php @@ -347,6 +347,18 @@ if (($device['os'] == 'routeros')) { $remote_port_name = (string) ($n_slot * 1000 + $n_port); } + if ($remote_device['os'] == 'netgear' && + $remote_device['sysDescr'] == 'GS108T' && + $lldp['lldpRemSysDesc'] == 'Smart Switch') { + // Some netgear switches, as Netgear GS108Tv1 presents it's port name over snmp as + // "Port 1 Gigabit Ethernet" but as 'lldpRemPortId' => 'g1' and + // 'lldpRemPortDesc' => 'Port #1' over lldp. + // So remap g1 to 1 so it matches ifIndex + if (preg_match("/^g(\d+)$/", $lldp['lldpRemPortId'], $matches)) { + $remote_port_name = $matches[1]; + } + } + $remote_port_id = find_port_id( $lldp['lldpRemPortDesc'], $remote_port_name,