NET SNMP 中的 snmp_synch_response() 何时返回 STAT_TIMEOUT?
我正在尝试使用 net-snmp5.5 从简单的 c 程序发出 SNMP v3 get 请求。代码如下:
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);
我在与 snmpd 相同的机器上运行它(即我的会话的对等参数 = localhost)。我总是得到状态== STAT_TIMEOUT。
但是,如果对于相同的凭据/用户执行 snmpwalk 或 snmpget,我会得到返回值吗?
什么会导致 snmp_synch_response 始终返回 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是回答这个问题,因为几乎不可能弄清楚这一点。
我面临的问题是,我用于 SNMPV3 通信的加密库在 DES 实现方面存在一些问题。但是,对于通信协议中的几乎所有错误,net-snmp 似乎都会返回此错误。
IE。无效的 header/无法解密/无法解码 ASN 等都会返回 STAT_TIMEOUT (当然,包括请求的实际超时)
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)