[SNMP4J] Report doesn't have ContextEngineID/ContextName when Request which has nonexistent ContextEngineID was recieved.
Frank Fock
fock at agentpp.com
Wed May 23 20:59:04 CEST 2007
OK, the required patch is too complex to
post it here. You can download the fixed
nightly build from
http://www.oosnmp.com/~katz/snapshot/
The date has to be 20070524 or later.
Best regards,
Frank
Kanda Norimichi wrote:
> Dear Mr. Fock:
>
> Thank you for your reply.
>
> I added correction program based on your advice and tried,
> so GetRequest was sent as response.
> I think perhaps it is because PDU-type isn't set.
> ----
> if (request.getCommandEvent().getMessageProcessingModel() == MPv3.ID) {
> ScopedPDU reportPDU = new ScopedPDU();
> reportPDU.setContextEngineID(request.getContextEngineID());
> reportPDU.setContextName(request.getContext());
> + reportPDU.setType(PDU.REPORT);
> reportPDU.add(new VariableBinding(SnmpConstants.snmpProxyDrops,
> cevent.getCurrentValue()));
> sendResponse(request.getCommandEvent(), reportPDU);
> }
> ----
> Report message became to be sent with above correction.
>
> In addition, I couldn't check the operation about one more
> correction (sendUnknownPDUHandlersReport()).
>
>
> And now, I found another problem that I think something is wrong with
> operation.
> Would you check that?
>
> Forwarding SNMPv1 Trap to SNMPv3 Manager,
> but in ProxyForwarderImpl#matchParameters(), comparative result of secName
> is NG and forward was failed in.
> So I debugged program, result of request.getSecurityName() was Community
> Name.
> I retraced more, in CommandProcessor#processPdu(),
> after succeeding in
> cinfo = coexistenceProvider.getCoexistenceInfo(sname);
> securityName of "event" isn't rewritten.
> (In the case of securityName which "cinfo" has,
> ProxyForwarderImpl#matchParameters() is succeeded in.)
>
> Where should I correct?
>
> Sincerely.
>
> Norimichi Kanda
>
>> -----Original Message-----
>> From: Frank Fock [mailto:fock at agentpp.com]
>> Sent: Tuesday, May 22, 2007 3:21 PM
>> To: Kanda Norimichi
>> Cc: snmp4j at agentpp.org
>> Subject: Re: [SNMP4J] Report doesn't have ContextEngineID/ContextName
>> when Request which has nonexistent ContextEngineID was recieved.
>>
>>
>> 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
>>
--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list