2009/8/12 [email protected] <[email protected]>:
> 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).
Good catch!
Try the following tweak to the code, and see if it fixes the problem:
> 419 if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
> NETSNMP_DS_LIB_16BIT_IDS))
> 420 retVal &= 0x7fff; /* mask to 15 bits */
> 421 else
> 422 retVal &= 0x7fffffff; /* mask to 31 bits */
if (!retVal) {
retVal = 2;
Reqid = retVal;
}
return retVal;
(This really needs locking around the Reqid assignment,
but let's see whether it works properly first).
Dave
------------------------------------------------------------------------------
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