Converting v2 traps to v1


Not a desired state long-term, but can SNMP4J convert v2 traps to v1? I see this discussed in RFC 2089. Thinking I may be able to receive input in the v2 message processing model and somehow map to v1 message processing model for output. My concern is that agent IP may be problematic since it does not appear to be a standard part of v2 traps.

Thanks, Todd

SNMP4J-Agent proxy implementations do convert SNMPv2 traps to v1 according the RFC 3584 (, §3.2.

It uses special MIB object snmpTrapAddress.0 defined in the RFC to support the SNMPv21 agent-addr field in SNMPv2c notifications.

When converting from SNMPv2 to v1 does the v1 agent-addr only get populated if it’s present as a varbind in the incoming SNMPv2 trap? I’ve created some code, but it looks incorrect. The value I’m seeing for agent-addr after SNMPv2 to v1 conversion is the IP of the transport listener.

Thanks, Todd

Or is there an alternate method to determine SNMPv2 agent address that doesn’t involve examining varbind contents? Seems many SNMPv2 traps I receive are not following standard varbind formats.

There is no other way, if the snmpTrapAddress.0 variable binding is not included, there will not be any possibility to determine it, because the sender IP is not the IP of the trap emitter.

In addition, the agent-addr field does not support IPv6 for example, that’s way why its usage has been deprecated.

That’s what I expected. My problem is I have to support the mess until standards can be established and enforced. What is the process and/or how difficult is it to extract the sender IP if I could take steps to preserve the trap emitter IP across the network?

I’m thinking I should write a program to send the trap owner an email every time I receive a trap that doesn’t contain snmpTrapAddress.0 :grinning:

In the CommandResponderEvent you get the source address of the notification/trap PDU with the getPeerAddress() method.

Does that answer your question?