>> The plot thickens; with "16bitIDs yes" set, the following PHP script
>> will crash before finishing (assuming that the snmpget actually
>> works):
>> <?
>> $maxI = 100000;
>> for( $i = 0; $i < $maxI; $i++ ) {
>> echo "$i :: ";
>> snmpget( '127.0.0.1', 'public', 'sysDescr.0' );
>> }
>> ?>
>>
>> Removing "16bitIDs yes" allows this script to finish withoutA trouble.
>>
>
> Preliminary tests show that net-snmp 5.4.3 does *not* have the issue;
> I'll be diffing the code to see what the problem was...
>
It looks like the following may have fixed the issue; apparently the
crash happens when the request ID gets to 0 (I see the request go out
and come back, but then we crash). This change apparently guarantees
that a nonzero request ID is returned.
--- net-snmp-5.4.2.1/snmplib/snmp_api.c 2008-05-27 17:22:12.000000000 -0400
+++ net-snmp-5.4.3/snmplib/snmp_api.c 2009-08-26 10:50:10.000000000 -0400
@@ -412,65 +412,85 @@ snmp_get_next_reqid(void)
long retVal;
snmp_res_lock(MT_LIBRARY_ID, MT_LIB_REQUESTID);
retVal = 1 + Reqid; /*MTCRITICAL_RESOURCE */
if (!retVal)
retVal = 2;
Reqid = retVal;
- snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_REQUESTID);
if (netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
NETSNMP_DS_LIB_16BIT_IDS))
- return (retVal & 0x7fff); /* mask to 15 bits */
+ retVal &= 0x7fff; /* mask to 15 bits */
else
- return (retVal & 0x7fffffff); /* mask to 31 bits */
+ retVal &= 0x7fffffff; /* mask to 31 bits */
+
+ if (!retVal) {
+ Reqid = retVal = 2;
+ }
+ snmp_res_unlock(MT_LIBRARY_ID, MT_LIB_REQUESTID);
+ return retVal;
}
Thanks for all the help.
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders