Hi Eric,
It works as it was designed ;-). I guess, you
are sending a SNMPv1 TRAP-PDU with SNMPv2c
which is a protocol violation.
Just send a NOTIFICATION PDU instead and
everything would be fine.
(Alternatively, you may send the V1TRAP
with SNMPv1)
Best regards,
Frank
On 18.03.2011 16:54, Eric Thiebaut wrote:
> Hi,
>
> I am sending a trap and trying to subscribe to it, but I'm facing some
> problems.
> I'm compiling against the released source package of of 1.11.2 (in order to
> debug).
>
> Sending the trap is pretty straight forward:
> PDUv1 pdu = new PDUv1();
> pdu.setType(PDU.V1TRAP);
> ...
> this.snmp.send(pdu, target);
>
> I can check with wireshark and my packet looks fine.
>
> Now I'm subscribing for events (actually in the same process):
> TransportMapping transport =
> new DefaultUdpTransportMapping(new
> UdpAddress("0.0.0.0/10160"));
> snmp = new Snmp(transport);
> snmp.addCommandResponder(this);
> transport.listen();
>
>
> All this is pretty straight forward.
> But when traps are received, the reception thread throws an exception in
> PDU.java
> as pduType.getValue() returns PDU.V1TRAP (as expected), which is not
> supported by the class PDU.
>
> The problem seems to come from MessageDispatcherImpl:
> Integer32 version = new Integer32();
> version.decodeBER(wholeMessage);
> MessageProcessingModel mp =
> getMessageProcessingModel(version.getValue());
>
> version decodes to 1. The mp at position 1 is MPv2c, and not MPv1 (which is
> at position 0).
> So when MPv2c decodes the pdu, it creates a PDU object and not PDUv1 object,
> which does not support v1 traps.
>
> Is this expected? At the moment I cannot receive my traps because of this.
> Am I doing something wrong?
>
> Thanks
>
> Eric
> _______________________________________________
> SNMP4J mailing list
> [email protected]
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com
_______________________________________________
SNMP4J mailing list
[email protected]
http://lists.agentpp.org/mailman/listinfo/snmp4j