[SNMP4J] contextEngineID in Informs issue

Joakim Althini joakim.althini at symsoft.com
Wed Jun 4 09:40:20 CEST 2008


Hi,

 

There seems to be a problem when sending informs; the authoritative engine
id is used in the outgoing scopedPDU's

contextEngineID which should identify the source of the data. This should be
used in securityEngineID because 

the receiver of an Inform is authoritative, but now both securityEngineID
and contextEngineID contains the authoritative

engine's id which does not seem to be correct.

 

I have tested sending informs using NetSNMP; then the sending agent's engine
id is used in contextEngineID.

 

The RFC's are not really crystal clear about this, but I found an IETF
discussion that clarifies it a bit:

http://www.ietf.org/mail-archive/web/isms/current/msg01652.html

 

I localized where the contextEngineId was set, it's on line 618 in MPv3.java

 

Best regards

 

/Joakim Althini, Symsoft

 

  public int prepareOutgoingMessage(Address transportAddress,

                                    int maxMessageSize,

                                    int messageProcessingModel,

                                    int securityModel,

                                    byte[] securityName,

                                    int securityLevel,

                                    PDU pdu,

                                    boolean expectResponse,

                                    PduHandle sendPduHandle,

                                    Address destTransportAddress,

                                    BEROutputStream outgoingMessage) throws

      IOException {

    if (!(pdu instanceof ScopedPDU)) {

      throw new IllegalArgumentException(

          "MPv3 only accepts ScopedPDU instances as pdu parameter");

    }

    ScopedPDU scopedPDU = (ScopedPDU) pdu;

    // lookup engine ID

    byte[] secEngineID = null;

    OctetString securityEngineID =

        (OctetString) engineIDs.get(transportAddress);

    if (securityEngineID != null) {

      secEngineID = securityEngineID.getValue();

      if (scopedPDU.getContextEngineID().length() == 0) {

        if (logger.isDebugEnabled()) {

          logger.debug("Context engine ID of scoped PDU is empty! Setting it
to authoritative engine ID: "+

                       securityEngineID.toHexString());

        }

        scopedPDU.setContextEngineID(new OctetString(secEngineID)); <--
Should use localEngineID instead!

      }

    }




More information about the SNMP4J mailing list