From 8bcfaf12d0511ed084db5116896de4377f25663b Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 9 Apr 2018 22:58:23 +0100 Subject: [PATCH] better way to construct short interface name --- lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm b/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm index 613e402a..ed5c3818 100644 --- a/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm +++ b/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm @@ -312,8 +312,8 @@ sub normalize_port { my $port = shift or return ''; my ($start, $end) = ('', ''); if ($port =~ m/^([a-z]{2})/i) { $start = $1 } - ($end = $port) =~ s/^\D+//; - return (quotemeta($start) .'%'. quotemeta($end)); + if ($port =~ m/[a-z]([^a-z]+)$/i) { $end = $1 } + return (($start && $end) ? "${start}${end}" : $port); } # take data from the topology table and update remote_ip and remote_port