[SNMP4J] contextEngineID in Informs issue

Frank Fock fock at agentpp.com
Fri Jun 6 00:10:16 CEST 2008


Hi Joakim,

Thank you for pointing that out. Strictly speaking,
the bug is in the NotificationOriginatorImpl which
does not set the contextEngineID. Nevertheless,
I have updated SNMP4J to use the local engine ID
for NOTIFICATION and INFORM PDUs as contextEngineID
when no contextEngineID is set in the ScopedPDU.

Best regards,
Frank

Joakim Althini wrote:
> 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!
> 
>       }
> 
>     }
> 
> _______________________________________________
> 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