lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [Question/Issue] SNMP 'set_value' always return SNMP_ERR_CO


From: Maxime Guyon
Subject: [lwip-devel] [Question/Issue] SNMP 'set_value' always return SNMP_ERR_COMMITFAILED or SNMP_ERR_UNDOFAILED on error
Date: Mon, 23 Oct 2017 18:03:07 +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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]