[AGENT++] MibComplexEntry::find_succ() override called at least twice

Stath, Paul pstath at axxcelera.com
Thu Oct 27 18:38:22 CEST 2011


While evaluating Agent++ as an embedded SNMP agent for our device, I was implementing a enterprise table as a subclass of MibComplexEntry.

While debugging my implementation, I discovered that the find_succ() method is being called a minimum of two times for each subrequest in the PDU.

Note:  Agent++ v3.5.31 compiled with _SNMPv3 defined.

In looking at the code, I can see that in the method Mib::process_request(Request *req, int reqind),
a call is made to Mib::find_next(MibContext* context, Oidx& oid, MibEntryPtr& entry, Request* req, const int).

For MibEntry subclasses where is_complex_node() is true, a call is made to entry->find_succ(), to simply determine IF there IS a "next" value.  (The returned "next" OID is discarded.)
Then, in the next_access_control() method, the entry->find_succ() method is called a second time, producing the same results as above.

It does appear that the next_access_control() method will not return until an OID that is viewable is found there is no "next" OID, so the problem
appears to be a single extra call to entry->find_succ() per MibEntry subclass, rather than N * 2 entry->find_succ() calls.

Would it be possible to refactor the Mib::process_request() method so that find_succ() doesn't end up being called more times than necessary?

-- Paul Stath
________________________________



More information about the AGENTPP mailing list