#392 fix heuristic neighbour detection

This commit is contained in:
Oliver Gorwits
2018-04-18 21:27:02 +01:00
parent f2ebd07c07
commit b36a9e5699
2 changed files with 7 additions and 8 deletions

View File

@@ -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;