[SNMP4J]About NotificatorOriginatorImpl and field agent-addr from Trapv1
Frank Fock
fock at agentpp.com
Wed Jan 17 02:31:19 CET 2007
Hi Nídia,
you can fix this by changing NotificationOriginatorImpl's
sendNotification method at:
...
else {
trap.setGenericTrap(genericID);
trap.setEnterprise(new OID(new int[] { 0,0 }));
}
//----> begin change
TransportMapping tm =
session.getMessageDispatcher().getTransport(address);
if ((tm != null) && (tm.getListenAddress() instanceof IpAddress)) {
InetAddress localAddress =
((IpAddress)tm.getListenAddress()).getInetAddress();
trap.setAgentAddress(new IpAddress(localAddress));
}
//----< end change
break;
}
case MessageProcessingModel.MPv2c: {
t = new CommunityTarget(address, community);
pdu = new PDU();
break;
}
...
However, this fix will not work when you setup your transport
mapping with 0.0.0.0 as local address. If you get a V1 trap
with 0.0.0.0 agent-addr field, then you should use the IP
address of the packet anyway.
Best regards,
Frank
Nídia S. Campos wrote:
> Hi,
> I'm using SNMP4J-Agent version 1.0.1 and when NotificatorOrignatorImpl
> sends a Trapv1, it does not set the field agent-addr with agent ip. What I
> can do?
>
> Thanks in advance,
--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list