
Mark,
Thanks for looking into this.
On 27/10/2015 02:25, Mark Martinec wrote:
- a fallback mechanism which tries to find a match on an interface's MAC address produces a wrong match, because typically all ports on larger switches have the same MAC address and the heuristics just picks the first match, which is almost always wrong. In case of multiple matches the matching on MAC should just fail, which at least would not produce a senseless match causing operators to scratch their heads and wonder who crossed the cables. The comment in lldp-mib.inc.php : // Find the device by MAC address, still matches multiple ports sometimes, we use the first one and hope we're lucky if very much misguided, as all port MAC addresses on a switch are typically the same, at least on all device types that I checked.
This worked for quite a number of devices I've checked, which all had different MACs per port. Indeed I have one that sees at least one other port as "port 1", and was planning on looking into that, pretty convinced it had to do with this too. I'll see later if this fixes it :-)
Actually there is also a Case 4, where lldpRemSysName shows a string "(none).(none)" instead of an empty string, when the (optional) system name is not configured. To fix:
if (empty($lldp['lldpRemSysName']) &&
$lldp['lldpRemChassisIdSubtype'] == 'macAddress')
if ((empty($lldp['lldpRemSysName']) ||
$lldp['lldpRemSysName'] == '(none).(none)') && $lldp['lldpRemChassisIdSubtype'] == 'macAddress')
I've seen (none).(none) as well, though I don't understand why that happens - I have 2 linux boxes both on the same switch and one shows up as none, the other with its correct hostname, both are running identically configured lldpd.
Thanks! Tom