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

Kanda Norimichi nkanda at fsi.co.jp
Fri May 25 04:47:07 CEST 2007


Dear Mr. Fock:

I confirmed that the right message was forwarded
from a application. 

Thank you very much for your support. 
I appreciate your kind cooperation.

Sincerely.

Norimichi Kanda.

> -----Original Message-----
> From: Frank Fock [mailto:fock at agentpp.com]
> Sent: Friday, May 25, 2007 4:53 AM
> 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.
> 
> 
> Ok, sorry. This was indeed a regression.
> The following patch corrects it:
> 
> --- ProxyForwarderImpl.java	(revision 235)
> +++ ProxyForwarderImpl.java	(working copy)
> @@ -328,7 +328,7 @@
>        target.add(new VariableBinding(SnmpConstants.snmpTrapEnterprise,
>                                       sourceV1.getEnterprise()));
>        OctetString community =
> -          new OctetString(request.getSecurityName());
> +          new OctetString(request.getCommandEvent().getSecurityName());
>        target.add(new VariableBinding(SnmpConstants.snmpTrapCommunity,
>                                       community));
>      }
> 
> Best regards,
> Frank
> 
> Kanda Norimichi wrote:
> > Dear Mr. Fock:
> > 
> > Thank you for your reply and support.
> > 
> > I retried with the corrected module,
> > I could confirm Trap message was forwarded.
> > 
> > But, snmpTrapCommunity value included in forwarded Trap
> > was value of coexistenceInfo.getSecurityName().
> > It would appear that the program code near ProxyForwardImpl.java 330th line
> > (proxyForwardTranslation()) needs to be corrected.
> > 
> > Sincerely.
> > 
> > Norimichi Kanda
> > 
> > 
> >> -----Original Message-----
> >> From: Frank Fock [mailto:fock at agentpp.com]
> >> Sent: Thursday, May 24, 2007 3:59 AM
> >> 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.
> >>
> >>
> >> 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
> >>
> 
> -- 
> AGENT++
> http://www.agentpp.com
> http://www.mibexplorer.com
> http://www.mibdesigner.com
> 



More information about the SNMP4J mailing list