From c7b8c3bcbd2e3ba965607b438bc534f4933c948f Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 17 Oct 2020 13:05:46 +0100 Subject: [PATCH] #748 always call NetAddr::MAC->new() with named mac param --- Changes | 1 + lib/App/Netdisco/DB/ResultSet/Device.pm | 4 ++-- lib/App/Netdisco/Util/Node.pm | 2 +- lib/App/Netdisco/Web/Plugin/Search/Port.pm | 2 +- lib/App/Netdisco/Web/Search.pm | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index c7f75d9e..97fcf62d 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,7 @@ [BUG FIXES] * #747 handle missing snmpEngineID + * #748 always call NetAddr::MAC->new() with named mac param 2.046002 - 2020-08-07 diff --git a/lib/App/Netdisco/DB/ResultSet/Device.pm b/lib/App/Netdisco/DB/ResultSet/Device.pm index fc67d3d6..1a7812b4 100644 --- a/lib/App/Netdisco/DB/ResultSet/Device.pm +++ b/lib/App/Netdisco/DB/ResultSet/Device.pm @@ -288,7 +288,7 @@ sub search_by_field { } # get IEEE MAC format - my $mac = NetAddr::MAC->new($p->{mac}); + my $mac = NetAddr::MAC->new(mac => $p->{mac}); undef $mac if ($mac and $mac->as_ieee and (($mac->as_ieee eq '00:00:00:00:00:00') @@ -401,7 +401,7 @@ sub search_fuzzy { } # get IEEE MAC format - my $mac = NetAddr::MAC->new($q); + my $mac = NetAddr::MAC->new(mac => $q); undef $mac if ($mac and $mac->as_ieee and (($mac->as_ieee eq '00:00:00:00:00:00') diff --git a/lib/App/Netdisco/Util/Node.pm b/lib/App/Netdisco/Util/Node.pm index 7405e4c9..475afea5 100644 --- a/lib/App/Netdisco/Util/Node.pm +++ b/lib/App/Netdisco/Util/Node.pm @@ -168,7 +168,7 @@ sub store_arp { my ($hash_ref, $now) = @_; $now ||= 'now()'; my $ip = $hash_ref->{'ip'}; - my $mac = NetAddr::MAC->new($hash_ref->{'node'}); + my $mac = NetAddr::MAC->new(mac => $hash_ref->{'node'}); my $name = $hash_ref->{'dns'}; return if !defined $mac or $mac->errstr; diff --git a/lib/App/Netdisco/Web/Plugin/Search/Port.pm b/lib/App/Netdisco/Web/Plugin/Search/Port.pm index cb82892d..dfd770e0 100644 --- a/lib/App/Netdisco/Web/Plugin/Search/Port.pm +++ b/lib/App/Netdisco/Web/Plugin/Search/Port.pm @@ -60,7 +60,7 @@ get '/ajax/content/search/port' => require_login sub { } else { my ( $likeval, $likeclause ) = sql_match($q); - my $mac = NetAddr::MAC->new($q); + my $mac = NetAddr::MAC->new(mac => $q); undef $mac if ($mac and $mac->as_ieee diff --git a/lib/App/Netdisco/Web/Search.pm b/lib/App/Netdisco/Web/Search.pm index cbf5718b..c9ea597e 100644 --- a/lib/App/Netdisco/Web/Search.pm +++ b/lib/App/Netdisco/Web/Search.pm @@ -38,7 +38,7 @@ get '/search' => require_login sub { else { my $nd = $s->resultset('Device')->search_fuzzy($q); my ($likeval, $likeclause) = sql_match($q); - my $mac = NetAddr::MAC->new($q); + my $mac = NetAddr::MAC->new(mac => $q); undef $mac if ($mac and $mac->as_ieee