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 11:17:48 +0200

throw aways the "set_value" call and immediately set/apply in the "set_test" call if it is no problem in your application

Ciao
Dirk


On Tue, Oct 24, 2017 at 10:15 AM, Maxime Guyon <address@hidden> wrote:
Hi,

Ho my appologize,

It indeed seem to be my problem, the "set_test" function is different from the "set" function because it speak with another remote system and for "save" trafic between the two system, I only trully speak with remote system when "set" is called.
Which seem to be a mistake here...

Thank you very much for your answer.

Regards

Max


2017-10-24 8:48 GMT+02:00 Dirk Ziegelmeier <address@hidden>:
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



_______________________________________________
lwip-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-devel



_______________________________________________
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]