#325 lazy load legacy RFC1213-MIB only if needed

This commit is contained in:
Oliver Gorwits
2019-04-20 07:42:58 +01:00
parent 141812bf4d
commit c73bc0ca2c

View File

@@ -3367,7 +3367,7 @@ $info->init() will throw an exception if a MIB does not load.
# been overridden during the compliation of the local Net-SNMP library.
# These cover the globals and funcs defined in this file.
'SNMPv2-MIB' => 'sysObjectID',
'RFC1213-MIB' => 'ipRouteIfIndex',
# (#325) 'RFC1213-MIB' => 'ipRouteIfIndex',
'IP-MIB' => 'ipAdEntAddr',
'IF-MIB' => 'ifIndex',
);
@@ -4835,6 +4835,11 @@ sub _validate_autoload_method {
return [1,(exists $self->{store}->{$method} ? 1: 0)];
}
# (#325) lazy load legacy RFC1213-MIB only if needed
SNMP::loadModules('RFC1213-MIB')
if $leaf_name =~ m/^(?:RFC1213-MIB::|ipr_|ipRoute)/
and not SNMP::translateObj($leaf_name);
# Translate MIB leaf node name to OID
my $oid = SNMP::translateObj($leaf_name);