Hi net-snmp-coders,
We are using net-snmp 5.9.1 as a proxy, and encountered a problem where
net-snmp will loop at response with endOfMibView.
The snmpd.conf is like this:
proxy -Cn context_vt1 -v 2c -t 100 -r 1 -c _proxy_comm_vt1 127.0.0.1:7667 .1.3
proxy -Cn context_vt2 -v 2c -t 100 -r 1 -c _proxy_comm_vt2 127.0.0.1:7667 .1.3
rocommunity _proxy_comm_vt1 localhost
rocommunity _proxy_comm_vt2 localhost
view vt1 included 1.3.6.1.4.1.41916
view vt1 excluded 1.3.6.1.4.1.41916.11.1
view vt2 included 1.3.6.1.4.1.41916
createUser u1 SHA-256 "1234567890" AES-256 "1234567890"
rouser u1 authpriv -V vt1 context_vt1
createUser u11 SHA-256 "1234567890" AES-256 "1234567890"
rouser u11 authpriv -V vt1 context_vt1
createUser u2 SHA-256 "1234567890" AES-256 "1234567890"
rouser u2 authpriv -V vt2 context_vt2
createUser u22 SHA-256 "1234567890" AES-256 "1234567890"
rouser u22 authpriv -V vt2 context_vt2
We have done the following fix to solve the problem. Please review and advise
if this is a good fix.
diff --git a/agent/snmp_agent.c b/agent/snmp_agent.c
index 3376357595..e7ac831380 100644
--- a/agent/snmp_agent.c
+++ b/agent/snmp_agent.c
@@ -2568,7 +2568,13 @@ check_acm(netsnmp_agent_session *asp, u_char type)
}
}
}
- snmp_set_var_typed_value(vb, type, NULL, 0);
+ /* Not to reset type for endOfMibView */
+ if (vb->type != SNMP_ENDOFMIBVIEW) {
+ snmp_set_var_typed_value(vb, type, NULL, 0);
+ } else {
+ DEBUGMSGTL(("check_acm",
+ "Not to reset for type
endOfMibView\n"));
+ }
if (ASN_PRIV_RETRY == type)
request->inclusive = 0;
}
@@ -3395,8 +3401,11 @@ check_getnext_results(netsnmp_agent_session *asp)
* illegal response from a subagent. Change it back to NULL
* xxx-rks: err, how do we know this is a subagent?
*/
+ /* This may cause a proxy agent loop.
request->requestvb->type = ASN_NULL;
request->inclusive = 1;
+ */
+ DEBUGMSGTL(("snmp_agent", "Not to mark endOfMibView NULL\n"));
}
if (request->requestvb->type == ASN_NULL ||
Thanks a lot.
Jenny
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders