Hello,
I have a question/remark with snmp module when a SET request fail:
In file "snmp_msg.c" at line 717, there is this code:
if (node_instance.set_value(&node_instance, vb.value_len, vb.value) != SNMP_ERR_NOERROR) {
if (request->inbound_varbind_enumerator.varbind_count == 1) {
request->error_status = SNMP_ERR_COMMITFAILED;
} else {
/* we cannot undo the set operations done so far */
request->error_status = SNMP_ERR_UNDOFAILED;
}
}
On error, this force the return value of an SNMP SET request to be SNMP_ERR_COMMITFAILED or SNMP_ERR_UNDOFAILED .
So if I returned another error like SNMP_ERR_WRONGVALUE, then I will never know that it was this error which failed the request because my return value is replaced.
My FIX for the moment is to simply remove the following line:
if (request->inbound_varbind_enumerator.varbind_count == 1) {
request->error_status = SNMP_ERR_COMMITFAILED;
} else {
/* we cannot undo the set operations done so far */
request->error_status = SNMP_ERR_UNDOFAILED;
}
}
Is there any mistake here?
Is there a reason that the return code of a SET request is overwriten?
Regards.