Bart Van Assche wrote:
 > Can you please create a bug report with the information you posted on
 > the Net-SNMP coders mailing list, and also the messages printed by
 > Valgrind, including the "Address ... is ... bytes inside a block of
 > size ... alloc'd" information ? See also
 > https://sourceforge.net/tracker/?group_id=12694&atid=112694.
 >
 > Bart.

Hi Bart,

yes will do. I had a deeper look into what is causing the STAT_ERROR to 
be returned in the first place - and I think I found another bug - which 
ties in with my "once every 30,000 gets" hunch.

snmp_synch_response_cb is returning STAT_ERROR and freeing the PDU 
because a reqid of 0 is returned. Looks like snmp_get_next_reqid has 
some rather fundamental bugs in the reqid wraparound logic (snmp_api.c:409)

409 long
410 snmp_get_next_reqid(void)
411 {
412     long            retVal;
413     snmp_res_lock(MT_LIBRARY_ID, MT_LIB_REQUESTID);
414     retVal = 1 + Reqid;         /*MTCRITICAL_RESOURCE */
415     if (!retVal)
416         retVal = 2;
417     Reqid = retVal;
418     snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_REQUESTID);
419     if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID, 
NETSNMP_DS_LIB_16BIT_IDS))
420         return (retVal & 0x7fff);   /* mask to 15 bits */
421     else
422         return (retVal & 0x7fffffff);       /* mask to 31 bits */
423 }

As I mentioned before - I am having to use 16 bit request ids. This code 
generates a requestid of 0 every 32,767 requests. For 32 bit request ids 
- it generates a 0 every 0xffffffff requests (probably not an issue, but 
still wrong).

It seems to have made assumptions about the sizeof long - for the 
wrapping logic [ if (!retVal) ] which do not hold, and then forgotten 
about 16 bit requestids. And having retVal as a signed long is confusing.

I guess I should post this as a bug too?

Many thanks,
Craig


__________ Information from ESET Smart Security, version of virus signature 
database 4328 (20090812) __________

The message was checked by ESET Smart Security.

http://www.eset.com



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to