开发者

When does snmp_synch_response() in NET SNMP return STAT_TIMEOUT?

开发者 https://www.devze.com 2023-03-20 21:41 出处:网络
I\'m trying to make an SNMP v3 get request from a simply c program using net-snmp5.5. The code is as below:

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!


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消