Subject: | Error index |
I found a bug in the PDU.pm, in which Net::SNMP will give out a bogus
error message. I discovered this problem trying to query a Motorola
VoIP modem. Here's the error message:
ERROR: Cannot get SNMP data (GI-BTI-MIB::btiUpsStatus.0 ->
1.3.6.1.4.1.1166.1.200.4.3.0): Received noError(0) error-status at
error-index 1
While I'm pretty sure the Motorola is misbehaving with the way it
outputs an error-index on a good packet, the module really shouldn't
spit out an error message, if the error-status is "noError". I have
seen another case of this error in PerlMonks as well:
http://www.perlmonks.org/?node_id=581453.
I have fixed this issue by removing the error_index check in the error
routine. This is confirmed to still be a problem in the latest 5.2.0
branch. Here is the modified patch:
*** PDU.pm.old 2007-09-27 13:14:56.447415482 -0400
--- PDU.pm 2007-09-27 13:16:05.938458641 -0400
***************
*** 787,793 ****
}
# Indicate that we have an SNMP error
! if (($this->{_error_status}) || ($this->{_error_index})) {
if ($this->{_pdu_type} != GET_BULK_REQUEST) {
$this->_error(
'Received %s error-status at error-index %d',
--- 787,793 ----
}
# Indicate that we have an SNMP error
! if ($this->{_error_status}) {
if ($this->{_pdu_type} != GET_BULK_REQUEST) {
$this->_error(
'Received %s error-status at error-index %d',