[SNMP4J] EngineID problem

Tony Offer tony.offer at gmail.com
Fri Oct 12 03:00:03 CEST 2007


I was experiencing a very similar problem.  When I ran my agent on one
network, a context engine ID was being created with IP address a.b.c.x
and this worked fine.  However, when I physically switched the agent
to another network, a context engine ID was being created with IP
address a.b.c.y, but this did not match the context engine ID in the
SNMP community table, which was still a.b.c.x.  This caused the
following check in CommandProcessor.processPDU() to fail:

if ((cinfo == null) ||
          (ownContextEngineID.equals(cinfo.getContextEngineID())))

Thus, an attempt was made to use the proxy forwarder, which I had not
set up, so this was failing as well and the agent was therefore not
responding to any SNMP requests.

As it turns out, the context engine ID with IP address a.b.c.x was
being written to the configuration file when the SNMP community table
was saved to persistent store.  Then, after switching networks, a
context engine ID was being created with IP address a.b.c.y and this
was successfully being added to the SNMP community table.  However,
this engine ID was then overwritten with the a.b.c.x version when the
SNMP community table was loaded from persistent store.  This resulted
in the context engine ID mismatch in CommandProcessor.processPDU().

To fix this, I simply changed the import mode of the configuration
file from REPLACE_CREATE to CREATE.  The CREATE import mode indicates
that a row should only be created in a table if it does not already
exist.  Thus, the context engine ID with IP address a.b.c.x no longer
overwrites the context engine ID with IP address a.b.c.y.

If one wants to preserve the behavior of the REPLACE_CREATE import
mode, then either special logic should be implemented to avoid
overwriting existing rows in the SNMP community table, or the SNMP
community table should be updated with the appropriate context engine
ID after the loadConfig() method has been invoked in the BaseAgent.

Regards,

Tony Offer

On 10/11/07, Frank Fock <fock at agentpp.com> wrote:
> Mark,
>
> The engine ID of the agent is not stored persistently
> by default (it should be hard set or the result of
> a fixed computation).
>
> When using SNMPv2c or SNMPv1, the community is mapped
> using the SNMP-COMMUNITY-MIB to a security name and
> context engine ID of the v3 security model.
> Here the problem seems to be originated. I hope this
> helps to find the cause.
>
> Best regards,
> Frank
>
> Mark Gorokhov wrote:
> > BTW, it's plain SNMPv2/public.
> >
> > I did not dive into persistent storage details
> > but these are exact steps to reproduce the problem.
> >
> > It's possible that there is a bug in my code. It's not clear why
> > removing snmp4j persistency storage and restarting the application fixes
> > the problem. This means (for me) that persistency storage knows
> > something about old EngineID and prevents work with new one.
> >
> > -mg
> >
> > -----Original Message-----
> > From: Frank Fock [mailto:fock at agentpp.com]
> > Sent: Tuesday, October 09, 2007 3:32 PM
> > To: Mark Gorokhov
> > Cc: SNMP4J at agentpp.org
> > Subject: Re: [SNMP4J] EngineID problem
> >
> > Hi Mark,
> >
> > Are you really sure that the engine ID is
> >
> > (a) stored in persistent storage by the agent
> > (b) it is modified while restoring the persistent storage?
> >
> > That the MIB browser times out after an engine ID
> > change is normal and wanted.
> >
> > Best regards,
> > Frank
> >
> > Mark Gorokhov wrote:
> >> Steps to reproduce the problem:
> >> 1. Start application with SNMP4J agent with EngineID
> >> "00:00:00:00:00:00:00:00:02"
> >> 2. MIB browser displays managed objects from the application.
> >> 3. Close the application (not kill!) This will create SNMP4J
> > persistency
> >> storage.
> >> 4. Start the same application with modified EngineID
> >> "00:00:00:00:00:00:00:00:03"
> >> PROBLEM: MIB browser timeouts to display managed objects from the
> >> application.
> >>
> >> The problem is fixed after persistency storage is deleted.
> >>
> >> How to load SNMP4J persistency storage and not to break EngineID?
> >>
> >> -mg
> >>
> >> _______________________________________________
> >> 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
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
>



More information about the SNMP4J mailing list