Search code examples
csnmpnet-snmp

When does snmp_synch_response() in NET SNMP return STAT_TIMEOUT?


I'm trying to make an SNMP v3 get request from a simply c program using net-snmp5.5. The code is as below:

struct snmp_session session;
/* I've set all the properties, to make an SNMPv3 get */

sessionHandle = snmp_sess_open(&session);

/* setup pdu with a get request for some oid */
status = snmp_synch_response(pdu, &response);

I'm running this on the same machine as the snmpd (ie. the peer param for my session = localhost). I'm always getting status == STAT_TIMEOUT.

However, if do a snmpwalk or snmpget, for the same credentials/user, I'm getting a return value?

What would cause snmp_synch_response to always return STAT_TIMEOUT? Any help is greatly appreciated!


Solution

  • Just answering this, since it was almost impossible to figure this out.

    The issue I was facing was that, the crypto library that I was using for the SNMPV3 communication, had some issue with DES implementation. However, it looks like net-snmp will return this error for almost any error in the communication protocol.

    Ie. invalid header/unable to decrypt/unable to decode ASN etc will all return STAT_TIMEOUT (ofcourse, including actual timeout of the request)