[#52] Check is neighbour remote_id is a MAC (R. Kerr)
This commit is contained in:
		| @@ -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] | ||||
|  | ||||
|   | ||||
| @@ -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}%" }}); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user