[#123] Allow devices with no LLDP/CDP to be found as Nodes
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
[ENHANCEMENTS]
|
||||
|
||||
* Port search also searches on the Remote ID and Type
|
||||
* [#123] Allow devices with no LLDP/CDP to be found as Nodes
|
||||
|
||||
2.029005 - 2014-08-13
|
||||
|
||||
|
||||
@@ -346,6 +346,8 @@ sub _walk_fwtable {
|
||||
next;
|
||||
}
|
||||
|
||||
my $vlan = $fw_vlan->{$idx} || $comm_vlan || '0';
|
||||
|
||||
# check to see if the port is connected to another device
|
||||
# and if we have that device in the database.
|
||||
|
||||
@@ -371,12 +373,13 @@ sub _walk_fwtable {
|
||||
debug sprintf
|
||||
' [%s] macsuck %s - port %s is detected uplink - skipping.',
|
||||
$device->ip, $mac, $port;
|
||||
|
||||
$skiplist->{$port} = [ $vlan, $mac ] # remember for later
|
||||
if exists $port_macs->{$mac};
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
my $vlan = $fw_vlan->{$idx} || $comm_vlan || '0';
|
||||
|
||||
if (exists $port_macs->{$mac}) {
|
||||
my $switch_ip = $port_macs->{$mac};
|
||||
if ($device->ip eq $switch_ip) {
|
||||
@@ -395,7 +398,8 @@ sub _walk_fwtable {
|
||||
if (not setting('macsuck_bleed')) {
|
||||
debug sprintf ' [%s] macsuck %s - adding port %s to skiplist',
|
||||
$device->ip, $mac, $port;
|
||||
$skiplist->{$port} = delete $cache->{$vlan}->{$port};
|
||||
|
||||
$skiplist->{$port} = [ $vlan, $mac ]; # remember for later
|
||||
next;
|
||||
}
|
||||
}
|
||||
@@ -410,6 +414,15 @@ sub _walk_fwtable {
|
||||
++$cache->{$vlan}->{$port}->{$mac};
|
||||
}
|
||||
|
||||
# restore MACs of neighbor devices.
|
||||
# this is when we have a "possible uplink" detected but we still want to
|
||||
# record the single MAC of the neighbor device so it works in Node search.
|
||||
foreach my $port (keys %$skiplist) {
|
||||
my ($vlan, $mac) = @{ $skiplist->{$port} };
|
||||
delete $cache->{$_}->{$port} for keys %$cache; # nuke nodes on all VLANs
|
||||
++$cache->{$vlan}->{$port}->{$mac};
|
||||
}
|
||||
|
||||
return $cache;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user