|
From: | Dirk Ziegelmeier |
Subject: | Re: [lwip-devel] [Question/Issue] SNMP 'set_value' always return SNMP_ERR_COMMITFAILED or SNMP_ERR_UNDOFAILED on error |
Date: | Tue, 24 Oct 2017 08:48:29 +0200 |
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.
_______________________________________________
lwip-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-devel
[Prev in Thread] | Current Thread | [Next in Thread] |