better way to construct short interface name

This commit is contained in:
Oliver Gorwits
2018-04-09 22:58:23 +01:00
parent d19b2fac93
commit 8bcfaf12d0

View File

@@ -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