[SNMP4J] Snmp INFORM response problem

Frank Fock fock at agentpp.com
Wed Sep 17 21:17:48 CEST 2008


Hi,

I would recommend using the 
http://www.snmp4j.org/doc/org/snmp4j/Snmp.html#addNotificationListener(org.snmp4j.smi.Address, 
org.snmp4j.CommandResponder)
hook to receive notifications and inform requests.
The snmp class will then send the response for you.
The UDP checksum error can be ignored.

The code below is buggy and should not be used.

Best regards,
Frank

Tayyab Akram wrote:
> Hi all,
> 
> I need some help,
> I have implemented trap receiver using Snmp4j and now I am sending SnmpV3
> INFORM using net-snmp tool "*snmpinform*"
> 
> I have implemented the *processPdu()* function to response the INFORM
> messages as told by Jeff.
> Still *snmpinform* fails due to bad response, Below is the output of the
> snmpinform command,
> 
> [root at localhost]# *snmpinform -v 3 -u wes localhost ''
> SNMPv2-MIB::sysLocation.0*
> *snmpinform: Timeout (plaintext scopedPDU header type A6: s/b 30)*
> 
> Can anybody tell me what's wrong???
> 
> I used WireShark paket sniffer to see the packets which shows,
> *snmpinform* sent 5 INFORMS (retries).... Against every INFORM my Trap
> Receiver sent response but Packet Sniffer shows that the response packets
> have *WRONG UDP CHECKSUM*.
> 
> Can anybody give some hint about what could be wrong???
> Why my code is sending Bad response?? Below is the implementation of my *
> processPdu()* function,
> 
>  public void processPdu(CommandResponderEvent crEvent) {
>         crEvent.setProcessed(true);
> 
>         PDU trapPDU = new PDU(crEvent.getPDU());
>         if(trapPDU != null) {
>             if(trapPDU.getType() == PDU.INFORM) {
>                 *PDU responsePDU = new PDU(trapPDU);*
>                 responsePDU.setErrorIndex(0);
>                 responsePDU.setErrorStatus(0);
>                 responsePDU.setType(PDU.RESPONSE);
>                 StatusInformation statusInfo = new StatusInformation();
>                 StateReference stateRef = crEvent.getStateReference();
>                 try {
>                     *crEvent.getMessageDispatcher().returnResponsePdu(
>                             crEvent.getMessageProcessingModel(),
>                             crEvent.getSecurityModel(),
>                             crEvent.getSecurityName(),
>                             crEvent.getSecurityLevel(),
>                             trapPDU,
>                             crEvent.getMaxSizeResponsePDU(),
>                             stateRef,
>                             statusInfo);*
> 
>                 } catch (MessageException msgEx) {
>                     Logger.error(msgEx);
>                 }
>             }
>         }
> 
> 
> Thanks in advance,
> --Tayyab
> _______________________________________________
> 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