[AGENT++] Agent++ handling SNMP requests that are too big

SCOTT Damien damien.scott at uk.thalesgroup.com
Thu Jun 13 12:12:04 CEST 2013


Hi Frank,

Thanks for your quick reply.

I am using (and will have to continue to use) SNMPv2c.  I have already increased the buffer size to 16K, which should be big enough for my needs.  However, I wanted the sender of the SNMP request to be notified if they did send an SNMP message that was too big (rather than it being discarded silently).  Could you explain the difference between an agent and a command responder?  My intention had been to implement an SNMP agent, but I am unsure how this would differ to a command responder.

I was more concerned that there may be a problem with the code.  Something didn't look quite right because the calling code (RequestList::receive() in request.cpp) processes the message if the call to receive() returns either SNMP_CLASS_SUCCESS or SNMP_ERROR_TOO_BIG.  It even creates a "request received" log entry, but with the 'community' and 'version' fields displayed as being at incorrect (default) values.  It only stops short of sending a response because the call to community_ok() fails (because 'community' was never set in the call to the receive() function).

With regard to the second (Windows-related) issue, the code excerpt I included suggests that the receive() function does not have consistent behaviour across all platforms.  Under a POSIX OS, a message that is too big will cause the receive() function to return SNMP_ERROR_TOO_BIG.  Under Windows, the same message would cause SNMP_CLASS_TL_FAILED to be returned.  I don't think that SNMP_ERROR_TOO_BIG can ever be returned by this function on a Windows platform.

Thanks in advance for any further assistance you can provide,

Damien


More information about the AGENTPP mailing list