(plugin) network::cisco::standard::snmp - mode bgp fix empty localAddr (#4199)

This commit is contained in:
qgarnier 2023-02-03 10:20:29 +00:00 committed by GitHub
parent c4f4f0face
commit 8f09c4f849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -219,7 +219,10 @@ sub manage_selection {
}
my $local;
if (length($result->{localAddr}) == 4) {
# it can be empty
if (length($result->{localAddr}) == 0) {
$local = '-';
} elsif (length($result->{localAddr}) == 4) {
$local = Socket::inet_ntop(Socket::AF_INET, $result->{localAddr}) . ':' . $result->{localPort};
} else {
$local = '[' . Socket::inet_ntop(Socket::AF_INET6, $result->{localAddr}) . ']:' . $result->{localPort};