On 12/10/06, Passera Pablo-APP015 <[EMAIL PROTECTED]> wrote:
It fixes the timeout problem for the set, but the errorIndex returned is
not correct. Since the set request has other states (RESERVE1, 2,
COMMIT, etc) , is it possible that the errorIndex to be set in other
part of the code?
OK - please find attached a patch to fix this problem properly.
This feels to be on the borderline between Bug-fix and New-feature.
But I think it's worth considering for the 5.4 release.
Can I therefore call for votes as to whether to include this fix or not.
Thanks
Dave
Index: include/net-snmp/agent/snmp_agent.h
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/include/net-snmp/agent/snmp_agent.h,v
retrieving revision 5.18
diff -u -r5.18 snmp_agent.h
--- include/net-snmp/agent/snmp_agent.h 28 Mar 2005 19:27:20 -0000 5.18
+++ include/net-snmp/agent/snmp_agent.h 17 Oct 2006 08:33:21 -0000
@@ -242,6 +242,8 @@
netsnmp_set_all_requests_error(netsnmp_agent_request_info *reqinfo,
netsnmp_request_info *requests,
int error_value);
+ int netsnmp_request_set_error_idx(netsnmp_request_info *requests,
+ int error_value, int idx);
int
netsnmp_request_set_error_all(netsnmp_request_info *requests,
int error_value);
Index: agent/snmp_agent.c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/agent/snmp_agent.c,v
retrieving revision 5.102
diff -u -r5.102 snmp_agent.c
--- agent/snmp_agent.c 19 Sep 2006 14:45:28 -0000 5.102
+++ agent/snmp_agent.c 17 Oct 2006 08:33:21 -0000
@@ -3425,6 +3425,34 @@
error_value);
}
+/** set error for a request within a request list
+ * @param request head of the request list
+ * @param error_value error value for request
+ * @param idx index of the request which has the error
+ */
+int
+netsnmp_request_set_error_idx(netsnmp_request_info *request,
+ int error_value, int idx)
+{
+ int i;
+ netsnmp_request_info *req = request;
+
+ if (!request || !request->agent_req_info)
+ return SNMPERR_NO_VARS;
+
+ /*
+ * Skip to the indicated varbind
+ */
+ for ( i=2; i<idx; i++) {
+ req = req->next;
+ if (!req)
+ return SNMPERR_NO_VARS;
+ }
+
+ return _request_set_error(req, request->agent_req_info->mode,
+ error_value);
+}
+
/** set error for all requests
* @param requests request list
* @param error error value for requests
Index: agent/mibgroup/ucd-snmp/proxy.c
===================================================================
RCS file: /cvsroot/net-snmp/net-snmp/agent/mibgroup/ucd-snmp/proxy.c,v
retrieving revision 5.25
diff -u -r5.25 proxy.c
--- agent/mibgroup/ucd-snmp/proxy.c 15 Sep 2006 00:48:42 -0000 5.25
+++ agent/mibgroup/ucd-snmp/proxy.c 17 Oct 2006 08:33:21 -0000
@@ -538,14 +538,15 @@
snmp_errstring(pdu->errstat), pdu->errindex));
netsnmp_handler_mark_requests_as_delegated(
requests, REQUEST_IS_NOT_DELEGATED);
- /*
- * XXX - both here and below, shouldn't the error be set
- * on the request with request->index == pdu->errindex ?
- */
- netsnmp_set_request_error(cache->reqinfo, requests, pdu->errstat);
+ netsnmp_request_set_error_idx(requests, pdu->errstat,
+ pdu->errindex);
}
- else
- netsnmp_set_request_error(cache->reqinfo, requests, pdu->errstat);
+ else {
+ netsnmp_handler_mark_requests_as_delegated( requests,
+ REQUEST_IS_NOT_DELEGATED);
+ netsnmp_request_set_error_idx(requests, pdu->errstat,
+ pdu->errindex);
+ }
/*
* update the original request varbinds with the results
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders