#310 multiple LLDP management addresses

This commit is contained in:
Oliver Gorwits
2017-06-24 18:47:42 +01:00
parent b93b6dbb83
commit 4ad9497784
2 changed files with 26 additions and 31 deletions

View File

@@ -10,7 +10,8 @@
* #320 DNS subroutines are redefined * #320 DNS subroutines are redefined
* #318 ACLs with RegExp are very slow - aggressive resolver timeouts * #318 ACLs with RegExp are very slow - aggressive resolver timeouts
* #317 #265 #311 when renumbering on discover, delete likely duplicate devices * #317 #265 #311 when renumbering on discover, delete likely duplicate devices
* #316 Neighbor map should fall back to device sysname after dns * #316 neighbor map should fall back to device sysname after dns
* #310 multiple LLDP management addresses
2.036001 - 2017-06-22 2.036001 - 2017-06-22

View File

@@ -829,29 +829,24 @@ sub store_neighbors {
} }
} }
# hack for devices seeing multiple neighbors on the port # what we came here to do.... discover the neighbor(s)
if (ref [] eq ref $remote_ip) { foreach my $n ((ref $remote_ip) ? @$remote_ip : ($remote_ip)) {
debug sprintf
' [%s] neigh - port %s has multiple neighbors, setting remote as self',
$device->ip, $port;
foreach my $n (@$remote_ip) {
debug sprintf debug sprintf
' [%s] neigh - adding neighbor %s, type [%s], on %s to discovery queue', ' [%s] neigh - adding neighbor %s, type [%s], on %s to discovery queue',
$device->ip, $n, ($remote_type || ''), $port; $device->ip, $n, ($remote_type || ''), $port;
push @to_discover, [$n, $remote_type]; push @to_discover, [$n, $remote_type];
} }
# set self as remote IP to suppress any further work # devices seeing multiple neighbors on the port
$remote_ip = $device->ip; # pick the highest IP for the neighbor, which results in preferring IPv6
$remote_port = $port; if (ref [] eq ref $remote_ip) {
}
else {
# what we came here to do.... discover the neighbor
debug sprintf debug sprintf
' [%s] neigh - adding neighbor %s, type [%s], on %s to discovery queue', ' [%s] neigh - port %s has multiple neighbors, picking highest',
$device->ip, $remote_ip, ($remote_type || ''), $port; $device->ip, $port;
push @to_discover, [$remote_ip, $remote_type];
$remote_ip = [reverse sort {NetAddr::IP::Lite->new($a)
<=> NetAddr::IP::Lite->new($b)} @$remote_ip]->[0];
}
$remote_port = $c_port->{$entry}; $remote_port = $c_port->{$entry};
if (defined $remote_port) { if (defined $remote_port) {
@@ -862,7 +857,6 @@ sub store_neighbors {
info sprintf ' [%s] neigh - no remote port found for port %s at %s', info sprintf ' [%s] neigh - no remote port found for port %s at %s',
$device->ip, $port, $remote_ip; $device->ip, $port, $remote_ip;
} }
}
$portrow->update({ $portrow->update({
remote_ip => $remote_ip, remote_ip => $remote_ip,