[#52] Check is neighbour remote_id is a MAC (R. Kerr)

This commit is contained in:
Oliver Gorwits
2014-01-11 14:08:46 +00:00
parent d264fb7d9d
commit 899563534a
2 changed files with 9 additions and 0 deletions

View File

@@ -13,6 +13,7 @@
* [#66] DB Schema update to add "native" column to PK of device_port_vlan table
* [#64] Addition of Wireshark abbreviations for OUI manufacturers
* [#79] Support perlbrew environment as alternative to localenv
* [#52] Check is neighbour remote_id is a MAC (R. Kerr)
[BUG FIXES]

View File

@@ -8,6 +8,7 @@ use App::Netdisco::Util::DNS ':all';
use NetAddr::IP::Lite ':lower';
use Encode;
use Try::Tiny;
use Net::MAC;
use base 'Exporter';
our @EXPORT = ();
@@ -662,6 +663,13 @@ sub store_neighbors {
' [%s] neigh - bad address %s on port %s, searching for %s instead',
$device->ip, $remote_ip, $port, $remote_id;
if (!defined $neigh) {
my $mac = Net::MAC->new(mac => $remote_id, 'die' => 0, verbose => 0);
if (not $mac->get_error) {
$neigh = $devices->single({mac => $remote_id});
}
}
if (!defined $neigh) {
(my $shortid = $remote_id) =~ s/\..*//;
$neigh = $devices->single({name => { -ilike => "${shortid}%" }});