Use NetAddr::IP::Lite to determine if EIGRP peer is a valid IP

This commit is contained in:
Eric A. Miller
2018-05-09 22:42:59 -04:00
parent f531c9d9a7
commit 4f8534169a
2 changed files with 6 additions and 6 deletions

View File

@@ -160,10 +160,10 @@ sub eigrp_peers {
my $peer = $peers->{$idx};
next unless $peer;
if ( ( $type eq 'ipv4' or $type eq 'ipv6' )
and $peer =~ /^(?:\w|\.|\:)+$/x )
{
$eigrp_peers{$idx} = $peer;
my $ip = NetAddr::IP::Lite->new($peer);
if ($ip) {
$eigrp_peers{$idx} = $ip->addr;
}
elsif ( $type eq 'ipv4' ) {
$eigrp_peers{$idx} = SNMP::Info::munge_ip($peer);