diff --git a/lib/App/Netdisco/Web/Plugin/Search/Node.pm b/lib/App/Netdisco/Web/Plugin/Search/Node.pm index 438a0f58..88aeea53 100644 --- a/lib/App/Netdisco/Web/Plugin/Search/Node.pm +++ b/lib/App/Netdisco/Web/Plugin/Search/Node.pm @@ -211,7 +211,9 @@ get '/ajax/content/search/node' => require_login sub { ->search_by_name({nbname => $likeval, @active, @times}); unless ( $set->has_rows ) { - if (my $ip = NetAddr::IP::Lite->new($node)) { + if ($node =~ m{^(?:$RE{net}{IPv4}|$RE{net}{IPv6})(?:/\d+)?$}i + and my $ip = NetAddr::IP::Lite->new($node)) { + # search_by_ip() will extract cidr notation if necessary $set = schema('netdisco')->resultset('NodeIp') ->search_by_ip({ip => $ip, @active, @times});