Merge branch 'bldewolf-L3-root_ip'
This commit makes the Layer3 root_ip determination a little more picky about the OSPF ID. My initial patch that Oliver committed would blindly accept the OSPF ID if it was set. Instead, we check if it's actually a route advertised by the device (in case someone uses OSPF IDs that aren't actually related to the device), otherwise we fall back to picking the first /32 in the routing table.
This commit is contained in:
@@ -163,10 +163,12 @@ sub root_ip {
|
|||||||
my $router_ip = $l3->router_ip();
|
my $router_ip = $l3->router_ip();
|
||||||
my $ospf_ip = $l3->ospf_ip();
|
my $ospf_ip = $l3->ospf_ip();
|
||||||
|
|
||||||
# if the router ip exists, we use it instead of OSPF host entries
|
# if the router ip exists and is a route advertised by the device we prefer
|
||||||
|
# it over the others
|
||||||
return $router_ip
|
return $router_ip
|
||||||
if (( defined $router_ip )
|
if (( defined $router_ip )
|
||||||
and ( $router_ip ne '0.0.0.0' )
|
and ( $router_ip ne '0.0.0.0' )
|
||||||
|
and ( grep { $ospf_ip->{$_} eq $router_ip } (keys %$ospf_ip))
|
||||||
and ( $l3->snmp_connect_ip($router_ip) ) );
|
and ( $l3->snmp_connect_ip($router_ip) ) );
|
||||||
|
|
||||||
# return the first one found here (should be only one)
|
# return the first one found here (should be only one)
|
||||||
|
|||||||
Reference in New Issue
Block a user