lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] [Question/Issue] SNMP 'set_value' always return SNMP_ER


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

I guess you have a problem in your implementation - when SNMP set is performed, each node gets a "set_test" AND a "set_value" call. Your "set_test" call says everything is fine, but your "set_value" call returns WrongValue - according to RFC1448 a failure in the "apply" phase of the SNMP set request is mapped to CommitFailed or UndoFailed in the response. A failure in the "test" phase would return the error value you that expect. -> Check your set_test implementation of the affected node.

Ciao
Dirk

--
Dirk Ziegelmeier * address@hidden * http://www.ziegelmeier.net

On Mon, Oct 23, 2017 at 6:03 PM, Maxime Guyon <address@hidden> wrote:
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



reply via email to

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