Skip to content

Commit

Permalink
feature: add other LLDP/CDP connection match checks
Browse files Browse the repository at this point in the history
  • Loading branch information
g-bougard committed Oct 2, 2018
1 parent 11568dc commit aaafc58
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ netdiscovery/netinventory:
* Fix #481: Add Synology NAS support
* Fix #480: Add CheckPoint support
* Fix #488: Update HP Printers support
* Updated LLDP/CDP connection match checks

collect:
* Thanks to David Durieux, add support for dynamic pattern in registry key
Expand Down
16 changes: 15 additions & 1 deletion lib/FusionInventory/Agent/Tools/Hardware.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,21 @@ sub _setConnectedDevices {
my $cdp_connection = $cdp_info->{$interface_id};

if ($lldp_connection) {
if ($cdp_connection->{SYSDESCR} eq $lldp_connection->{SYSDESCR}) {
my $match = 0;

# Try different case to find LLDP/CDP connection match
if ($lldp_connection->{SYSDESCR} && $cdp_connection->{SYSDESCR} eq $lldp_connection->{SYSDESCR}) {
$match ++;
} elsif ($lldp_connection->{SYSNAME} && $cdp_connection->{SYSNAME}) {
my $cdp_test = getCanonicalMacAddress($cdp_connection->{SYSNAME});
if ($cdp_connection->{SYSNAME} eq $lldp_connection->{SYSNAME}) {
$match ++;
} elsif ($lldp_connection->{SYSMAC} && $cdp_test && $lldp_connection->{SYSMAC} eq $cdp_test) {
$match ++;
}
}

if ($match) {
# same device, everything OK
foreach my $key (qw/IP MODEL/) {
$lldp_connection->{$key} = $cdp_connection->{$key};
Expand Down

0 comments on commit aaafc58

Please sign in to comment.