[AGENT++] SNMP++ bug

mjob at vp.pl mjob at vp.pl
Tue Jan 31 09:58:20 CET 2006


Hi,

 

I guess there is a bug in snmp++ library. In a file uxsnmp.cpp in
receive_snmp_notification function there is an instruction like below:

 

if (receive_buffer_len <= 0 )                // error or no data pending
    return SNMP_CLASS_TL_FAILED;

 

So if we get an error or empty UDP datagram the functions returns
SNMP_CLASS_TL_FAILED.

 

In a file notifyqueue.cpp in CNotifyEventQueue::HandleEvents function there
are such instructions:

 

if (SNMP_CLASS_SUCCESS == status ||
 SNMP_CLASS_TL_FAILED == status) {
      // If we have transport layer failure, the app will want to
      // know about it.
      // Go through each snmp object and check the filters, making
      // callbacks as necessary

      // LiorK: on failure target will be NULL
      if (!target)
        target = new SnmpTarget();

      while (notifyEltPtr){

 notifyEltPtr->GetNotifyEvent()->Callback(*target, pdu,
       status);
 notifyEltPtr = notifyEltPtr->GetNext();
      } // for each snmp object

 

I checked what happens when I send an empty UDP datagram to the trap port.
When I did the library crashed on the bolded line. What for we call Callback
function when we received an empty UDP datagram or if there was an error in
communication? I would remove a condition "||
 SNMP_CLASS_TL_FAILED == status" from if statement. I did it and it seems
that everything works correctly but I'd like to be sure that. Thanks for
opinions and help

 

Regards,

arek

 



More information about the AGENTPP mailing list