From c73bc0ca2c43017382af3b14b0010f67f3fd8901 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 20 Apr 2019 07:42:58 +0100 Subject: [PATCH] #325 lazy load legacy RFC1213-MIB only if needed --- lib/SNMP/Info.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/SNMP/Info.pm b/lib/SNMP/Info.pm index 056136b8..72746fa6 100644 --- a/lib/SNMP/Info.pm +++ b/lib/SNMP/Info.pm @@ -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);