[SNMP4J] Report doesn't have ContextEngineID/ContextName when Request which has nonexistent ContextEngineID was recieved.

Frank Fock fock at agentpp.com
Tue May 22 08:20:59 CEST 2007


Hello Mr. Kanda,

Thank you for your bug report. The following
patch should fix it:

@@ -299,8 +299,12 @@
     CounterEvent counter =
         new CounterEvent(this, SnmpConstants.snmpUnknownPDUHandlers);
     fireIncrementCounter(counter);
-    if (command.getMessageProcessingModel() ==
MessageProcessingModel.MPv3) {
-      PDU report = new PDU();
+    if ((command.getMessageProcessingModel() ==
MessageProcessingModel.MPv3) &&
+        (command.getPDU() instanceof ScopedPDU)) {
+      ScopedPDU request = (ScopedPDU) command.getPDU();
+      ScopedPDU report = new ScopedPDU();
+      report.setContextEngineID(request.getContextEngineID());
+      report.setContextName(request.getContextName());
       report.setType(PDU.REPORT);
       report.add(new VariableBinding(counter.getOid(),
                                      counter.getCurrentValue()));
@@ -525,7 +529,9 @@

SnmpConstants.snmpProxyDrops);
         fireIncrementCounter(cevent);
         if (request.getCommandEvent().getMessageProcessingModel() ==
MPv3.ID) {
-          PDU reportPDU = new PDU();
+          ScopedPDU reportPDU = new ScopedPDU();
+          reportPDU.setContextEngineID(request.getContextEngineID());
+          reportPDU.setContextName(request.getContext());
           reportPDU.add(new VariableBinding(SnmpConstants.snmpProxyDrops,
                                             cevent.getCurrentValue()));
           sendResponse(request.getCommandEvent(), reportPDU);

Best regards,
Frank

Kanda Norimichi wrote:
> Dear Mr. Fock:
> 
> I am Kanda and I work at Fujisoft.
> 
> I made SNMP Agent (with ProxyForwarder) using SNMP4J-agent.
> In the case of sending GetRequest which has wrong ContextEngineID to that 
> Agent,the Report(Response?) whose PDU part is incorrect format was returned.
> 
> So I debugged program, in CommandProcessor.java 528th line,
> the PDU instance created is set at PDU part instead of ScopedPDU which 
> is used in SNMPv3.
> Is it intended operation?
> 
> So, in that case, would you tell me if you have some idea about other 
> thinkable probelem in your mind?
> 
> Sincerely.
> 
> Norimichi Kanda
> 
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com




More information about the SNMP4J mailing list