diff --git a/Changes b/Changes index c1570af2..101d9aea 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,7 @@ [BUG FIXES] + * #392 fix heuristic neighbour detection * #393 avoid 'modification of readonly variable' error in netmap * clean up check_mac() interface (ml-cms) diff --git a/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm b/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm index d34015e3..50618017 100644 --- a/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm +++ b/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm @@ -174,6 +174,12 @@ sub store_neighbors { next unless $remote_ip; my $r_netaddr = NetAddr::IP::Lite->new($remote_ip); + if ($r_netaddr and ($r_netaddr->addr ne $remote_ip)) { + info sprintf ' [%s] neigh - discrepancy in IP on %s: using %s instead of %s', + $device->ip, $port, $r_netaddr->addr, $remote_ip; + $remote_ip = $r_netaddr->addr; + } + # a bunch of heuristics to search known devices if we don't have a # useable remote IP... @@ -231,14 +237,6 @@ sub store_neighbors { } } - if ($r_netaddr->addr ne $remote_ip) { - info sprintf ' [%s] neigh - discrepancy in IP on %s: using %s instead of %s', - $device->ip, $port, $r_netaddr->addr, $remote_ip; - } - - # OK, remote IP seems sane - $remote_ip = $r_netaddr->addr; - # what we came here to do.... discover the neighbor debug sprintf ' [%s] neigh - %s with ID [%s] on %s', $device->ip, $remote_ip, ($remote_id || ''), $port;