From 00f3f2a796fedf715a4d86792d68f809293886ae Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Tue, 10 Apr 2018 20:58:05 +0100 Subject: [PATCH] Revert "work for shortening or lengthening ports" This reverts commit 9d48c4a025f7b0ce61f8c24025b948df53c26f44. --- lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm b/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm index 5e15a56f..ed5c3818 100644 --- a/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm +++ b/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm @@ -259,8 +259,7 @@ sub store_neighbors { ip => $peer_device->ip, port => [ {'=', $remote_port}, - {'-ilike', long_port($remote_port)}, - {'-ilike', short_port($remote_port)}, + {'-ilike', normalize_port($remote_port)}, {'-ilike', ('%'.quotemeta($remote_port))}, ], }, { rows => 1 })->single(); @@ -309,13 +308,7 @@ sub store_neighbors { return @to_discover; } -sub long_port { - my $port = shift or return ''; - $port =~ s/^([a-z]{2})([^a-z].+)$/$1%$2/i; - return $port; -} - -sub short_port { +sub normalize_port { my $port = shift or return ''; my ($start, $end) = ('', ''); if ($port =~ m/^([a-z]{2})/i) { $start = $1 }