Skip to content

Commit

Permalink
Merge pull request networkupstools#1682 from eric3873/fix_snmpv3_walk
Browse files Browse the repository at this point in the history
Fix walk issue with snmpv3 (** add type error exception **)
  • Loading branch information
jimklimov authored Oct 19, 2022
2 parents cc60640 + 5a81345 commit 755b005
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion drivers/snmp-ups.c
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,20 @@ static struct snmp_pdu **nut_snmp_walk(const char *OID, int max_iteration)
snmp_free_pdu(response);
break;
} else {
numerr = 0;
/* Checked the "type" field of the returned varbind if it is a type error
* exception (only applicable with SNMPv2 or SNMPv3 protocol) */
if (response->variables->type == SNMP_NOSUCHOBJECT ||
response->variables->type == SNMP_NOSUCHINSTANCE ||
response->variables->type == SNMP_ENDOFMIBVIEW) {
upslogx(LOG_WARNING, "[%s] Warning: type error exception (OID = %s)",
upsname?upsname:device_name, OID);
snmp_free_pdu(response);
break;
}
else {
/* no error */
numerr = 0;
}
}

nb_iteration++;
Expand Down

0 comments on commit 755b005

Please sign in to comment.