[SNMP4J] proxy forwarding in Beta 5

Glenn Gerhardt (glgerhar) glgerhar at cisco.com
Fri Aug 4 03:20:37 CEST 2006


 
Frank,
In SNMP4-agent version beta 4, I was able to proxy forward with 
the combinations (front-side/back-side) v1/v1, v1/v2c, v2c/v1 and
v2c/v2c.
Any sort of proxy that included v3 had the exceptions you feel are fixed

in Beta 5.  I have yet to verify those fixes, but will be doing so
shortly.

However, in version Beta 5 I have found that the previously working 
proxy combinations have stopped working.  I found that in Beta 5, the 
request ID of the response on the front side of the proxy was not being 
set back to that of the original request.  As a result, get request tool

did not recognize the response.

I've made the following changes to ProxyForwarderImpl.forward to correct
this issue.
-Glenn

      if ((resp != null) && (resp.getResponse() != null)) {
        PDU respPDU = resp.getResponse();
        PDU translatedResponse = DefaultPDUFactory.createPDU(
            request.getCommandEvent().getSecurityModel());
        if (!translatedResponse.getClass().equals(respPDU)) {
          // not required PDU instance -> copy data
          translatedResponse.setType(respPDU.getType());
          translatedResponse.addAll(respPDU.toArray());
          translatedResponse.setErrorIndex(respPDU.getErrorIndex());
          translatedResponse.setErrorStatus(respPDU.getErrorStatus());
          // FIX: added to get the original request id in the response
 
translatedResponse.setRequestID(request.getCommandEvent().getPDU().getRe
questID());
        }
        else {
          translatedResponse = respPDU;
        }
        // FIX: changed from respPDU to translatedResponse
        request.setResponsePDU(translatedResponse);
        return true;




More information about the SNMP4J mailing list