From 4b70bfa7c8785b0a9ad6dd7ccf5d0f48fea1d273 Mon Sep 17 00:00:00 2001 From: Eric Miller <> Date: Wed, 5 Apr 2006 02:09:06 +0000 Subject: [PATCH] check for unreachable root ip before assignment --- Info/Layer3.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Info/Layer3.pm b/Info/Layer3.pm index c0f660c5..55075f02 100644 --- a/Info/Layer3.pm +++ b/Info/Layer3.pm @@ -112,17 +112,18 @@ sub root_ip { my $router_ip = $l3->router_ip(); my $ospf_ip = $l3->ospf_ip(); - # return the first one found here (should be only) + # return the first one found here (should be only one) if (defined $ospf_ip and scalar(keys %$ospf_ip)){ foreach my $key (keys %$ospf_ip){ my $ip = $ospf_ip->{$key}; next if $ip eq '0.0.0.0'; + next unless $l3->_snmp_connect_ip($ip); print " SNMP::Layer3::root_ip() using $ip\n" if $l3->debug(); return $ip; } } - return $router_ip if (defined $router_ip and $router_ip ne '0.0.0.0'); + return $router_ip if ( (defined $router_ip) and ($router_ip ne '0.0.0.0') and ($l3->_snmp_connect_ip($router_ip)) ); return undef; }