[SNMP4J] SNMP Agent - Error in encoding v1 trap (Agent Address).

Senthil Muniswamy senthil.muniswamy at gmail.com
Fri Jul 13 03:02:33 CEST 2007


Frank,

I am running an agent with proxy forwarding capability that uses
SNMP4J v1.8.2 with SNMP4J-Agent v1.1.3.

Generated a v2 trap to forward as v1 trap. It fails to encode while
preparing the outgoing message with BufferOverflowException.

Reason is the BER length differs for v1 trap Agent Address when
calculating the buffer size and actual encoding. While encoding the
address includes additional 2 bytes for port in
TransportIpAddress.getValue() method.

Agent hangs after encountering this exception for couple of times.

Exception for your reference:

20:20:15,218 INFO  [STDOUT] 180813 [DefaultUDPTransportMapping_172.16.15.113/162
] DEBUG org.snmp4j.transport.DefaultUdpTransportMapping  - Received message from
 /172.16.15.114/2887 with length 86: 30:54:02:01:01:04:06:70:75:62:6c:69:63:a7:4
7:02:01:01:02:01:00:02:01:00:30:3c:30:0f:06:08:2b:06:01:02:01:01:03:00:43:03:01:
e2:40:30:17:06:0a:2b:06:01:06:03:01:01:04:01:00:06:09:2b:06:01:06:03:01:01:05:01
:30:10:06:08:2b:06:01:02:01:01:05:00:04:04:74:65:73:74
20:20:15,249 INFO  [STDOUT] 180844 [DefaultUDPTransportMapping_172.16.15.113/162
] DEBUG org.snmp4j.Snmp  - Fire process PDU event: CommandResponderEvent[transpo
rtMapping=org.snmp4j.transport.DefaultUdpTransportMapping at 5291d9peerAddress=172.
16.15.114/2887, processed=false, pdu=[TRAP[requestID=1, errorStatus=Success(0),
errorIndex=0, VBS[1.3.6.1.2.1.1.3.0 = 0:20:34.56; 1.3.6.1.6.3.1.1.4.1.0 = 1.3.6.
1.6.3.1.1.5.1; 1.3.6.1.2.1.1.5.0 = test]]], securityName=public, securityModel=2
, securityLevel=1]
20:20:15,264 INFO  [STDOUT] 180859 [DefaultUDPTransportMapping_172.16.15.113/162
] DEBUG org.snmp4j.agent.mo.snmp.SnmpCommunityMIB  - Looking up coexistence info
 for 'public'
20:20:15,264 INFO  [STDOUT] 180859 [DefaultUDPTransportMapping_172.16.15.113/162
] DEBUG org.snmp4j.agent.mo.snmp.SnmpCommunityMIB  - Found coexistence info for
'public'=CoexistenceInfo[securityName=public,contextEngineID=,contextName=,trans
portTag=]
20:20:15,280 INFO  [STDOUT] 180875 [DefaultUDPTransportMapping_172.16.15.113/162
] DEBUG org.snmp4j.agent.mo.snmp.SnmpCommunityMIB  - Address 172.16.15.114/2887
passes filter, because source address filtering is disabled
20:20:15,296 INFO  [STDOUT] 180891 [DefaultUDPTransportMapping_172.16.15.113/162
] DEBUG org.snmp4j.agent.CommandProcessor  - Processsing proxy request with prox
y forwarder org.snmp4j.agent.mo.snmp.ProxyForwarderImpl at 1de5e71
20:20:15,296 INFO  [STDOUT] 180891 [SMCAgentPool.0] DEBUG org.snmp4j.agent.mo.sn
mp.ProxyForwarderImpl  - Checking possible match for in parameter: 3
20:20:15,311 INFO  [STDOUT] 180906 [SMCAgentPool.0] DEBUG org.snmp4j.agent.mo.sn
mp.ProxyForwarderImpl  - Matching request org.snmp4j.agent.ProxyForwardRequest[c
oexistenceInfo=CoexistenceInfo[securityName=public,contextEngineID=,contextName=
,transportTag=],proxyType=3,commandEvent=CommandResponderEvent[transportMapping=
org.snmp4j.transport.DefaultUdpTransportMapping at 5291d9peerAddress=172.16.15.114/
2887, processed=false, pdu=[TRAP[requestID=1, errorStatus=Success(0), errorIndex
=0, VBS[1.3.6.1.2.1.1.3.0 = 0:20:34.56; 1.3.6.1.6.3.1.1.4.1.0 = 1.3.6.1.6.3.1.1.
5.1; 1.3.6.1.2.1.1.5.0 = test]]], securityName=public, securityModel=2, security
Level=1]]  with mpModel=0, secModel=1, secLevel=1, secName=private
20:20:15,311 INFO  [STDOUT] 180906 [SMCAgentPool.0] DEBUG org.snmp4j.agent.mo.sn
mp.ProxyForwarderImpl  - Checking possible match for in parameter: 4
20:20:15,311 INFO  [STDOUT] 180906 [SMCAgentPool.0] DEBUG org.snmp4j.agent.mo.sn
mp.ProxyForwarderImpl  - Matching request org.snmp4j.agent.ProxyForwardRequest[c
oexistenceInfo=CoexistenceInfo[securityName=public,contextEngineID=,contextName=
,transportTag=],proxyType=3,commandEvent=CommandResponderEvent[transportMapping=
org.snmp4j.transport.DefaultUdpTransportMapping at 5291d9peerAddress=172.16.15.114/
2887, processed=false, pdu=[TRAP[requestID=1, errorStatus=Success(0), errorIndex
=0, VBS[1.3.6.1.2.1.1.3.0 = 0:20:34.56; 1.3.6.1.6.3.1.1.4.1.0 = 1.3.6.1.6.3.1.1.
5.1; 1.3.6.1.2.1.1.5.0 = test]]], securityName=public, securityModel=2, security
Level=1]]  with mpModel=1, secModel=2, secLevel=1, secName=private
20:20:15,327 INFO  [STDOUT] 180922 [SMCAgentPool.0] DEBUG org.snmp4j.agent.mo.sn
mp.ProxyForwarderImpl  - Checking possible match for in parameter: 5
20:20:15,327 INFO  [STDOUT] 180922 [SMCAgentPool.0] DEBUG org.snmp4j.agent.mo.sn
mp.ProxyForwarderImpl  - Matching request org.snmp4j.agent.ProxyForwardRequest[c
oexistenceInfo=CoexistenceInfo[securityName=public,contextEngineID=,contextName=
,transportTag=],proxyType=3,commandEvent=CommandResponderEvent[transportMapping=
org.snmp4j.transport.DefaultUdpTransportMapping at 5291d9peerAddress=172.16.15.114/
2887, processed=false, pdu=[TRAP[requestID=1, errorStatus=Success(0), errorIndex
=0, VBS[1.3.6.1.2.1.1.3.0 = 0:20:34.56; 1.3.6.1.6.3.1.1.4.1.0 = 1.3.6.1.6.3.1.1.
5.1; 1.3.6.1.2.1.1.5.0 = test]]], securityName=public, securityModel=2, security
Level=1]]  with mpModel=0, secModel=1, secLevel=1, secName=public
20:20:15,343 INFO  [STDOUT] 180938 [SMCAgentPool.0] DEBUG org.snmp4j.agent.mo.sn
mp.ProxyForwarderImpl  - Checking possible match for in parameter: 6
20:20:15,343 INFO  [STDOUT] 180938 [SMCAgentPool.0] DEBUG org.snmp4j.agent.mo.sn
mp.ProxyForwarderImpl  - Matching request org.snmp4j.agent.ProxyForwardRequest[c
oexistenceInfo=CoexistenceInfo[securityName=public,contextEngineID=,contextName=
,transportTag=],proxyType=3,commandEvent=CommandResponderEvent[transportMapping=
org.snmp4j.transport.DefaultUdpTransportMapping at 5291d9peerAddress=172.16.15.114/
2887, processed=false, pdu=[TRAP[requestID=1, errorStatus=Success(0), errorIndex
=0, VBS[1.3.6.1.2.1.1.3.0 = 0:20:34.56; 1.3.6.1.6.3.1.1.4.1.0 = 1.3.6.1.6.3.1.1.
5.1; 1.3.6.1.2.1.1.5.0 = test]]], securityName=public, securityModel=2, security
Level=1]]  with mpModel=1, secModel=2, secLevel=1, secName=public
20:20:15,358 INFO  [STDOUT] 180953 [SMCAgentPool.0] DEBUG org.snmp4j.agent.mo.sn
mp.ProxyForwarderImpl  - Proxy multiple targets out with tags [172.16.15.114]
20:20:15,374 ERROR [STDERR] Exception in thread "SMCAgentPool.0"
20:20:15,374 INFO  [STDOUT] 180969 [SMCAgentPool.0] ERROR STDERR  - Exception in
 thread "SMCAgentPool.0"
20:20:15,374 ERROR [STDERR] java.nio.BufferOverflowException
20:20:15,389 INFO  [STDOUT] 180969 [SMCAgentPool.0] ERROR STDERR  - java.nio.Buf
ferOverflowException
20:20:15,389 ERROR [STDERR]     at java.nio.HeapByteBuffer.put(HeapByteBuffer.ja
va:165)
20:20:15,389 INFO  [STDOUT] 180984 [SMCAgentPool.0] ERROR STDERR  -     at java.
nio.HeapByteBuffer.put(HeapByteBuffer.java:165)
20:20:15,389 ERROR [STDERR]     at java.nio.ByteBuffer.put(ByteBuffer.java:812)
20:20:15,405 INFO  [STDOUT] 180984 [SMCAgentPool.0] ERROR STDERR  -     at java.
nio.ByteBuffer.put(ByteBuffer.java:812)
20:20:15,405 ERROR [STDERR]     at org.snmp4j.asn1.BEROutputStream.write(BEROutp
utStream.java:71)
20:20:15,405 INFO  [STDOUT] 181000 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.asn1.BEROutputStream.write(BEROutputStream.java:71)
20:20:15,405 ERROR [STDERR]     at org.snmp4j.asn1.BER.encodeString(BER.java:350
)
20:20:15,405 INFO  [STDOUT] 181000 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.asn1.BER.encodeString(BER.java:350)
20:20:15,405 ERROR [STDERR]     at org.snmp4j.smi.OctetString.encodeBER(OctetStr
ing.java:146)
20:20:15,421 INFO  [STDOUT] 181000 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.smi.OctetString.encodeBER(OctetString.java:146)
20:20:15,421 ERROR [STDERR]     at org.snmp4j.smi.VariableBinding.encodeBER(Vari
ableBinding.java:176)
20:20:15,421 INFO  [STDOUT] 181016 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.smi.VariableBinding.encodeBER(VariableBinding.java:176)
20:20:15,421 ERROR [STDERR]     at org.snmp4j.PDUv1.encodeBER(PDUv1.java:214)
20:20:15,421 INFO  [STDOUT] 181016 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.PDUv1.encodeBER(PDUv1.java:214)
20:20:15,436 ERROR [STDERR]     at org.snmp4j.mp.MPv1.prepareOutgoingMessage(MPv
1.java:110)
20:20:15,436 INFO  [STDOUT] 181031 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.mp.MPv1.prepareOutgoingMessage(MPv1.java:110)
20:20:15,436 ERROR [STDERR]     at org.snmp4j.MessageDispatcherImpl.sendPdu(Mess
ageDispatcherImpl.java:418)
20:20:15,436 INFO  [STDOUT] 181031 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.MessageDispatcherImpl.sendPdu(MessageDispatcherImpl.java:418)
20:20:15,436 ERROR [STDERR]     at org.snmp4j.Snmp.sendMessage(Snmp.java:949)
20:20:15,436 INFO  [STDOUT] 181031 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.Snmp.sendMessage(Snmp.java:949)
20:20:15,452 ERROR [STDERR]     at org.snmp4j.Snmp.send(Snmp.java:789)
20:20:15,452 INFO  [STDOUT] 181047 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.Snmp.send(Snmp.java:789)
20:20:15,452 ERROR [STDERR]     at org.snmp4j.Snmp.send(Snmp.java:753)
20:20:15,452 INFO  [STDOUT] 181047 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.Snmp.send(Snmp.java:753)
20:20:15,452 ERROR [STDERR]     at org.snmp4j.agent.mo.snmp.ProxyForwarderImpl.m
ultipleForward(ProxyForwarderImpl.java:409)
20:20:15,452 INFO  [STDOUT] 181047 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.agent.mo.snmp.ProxyForwarderImpl.multipleForward(ProxyForwarderImpl.java:4
09)
20:20:15,468 ERROR [STDERR]     at org.snmp4j.agent.mo.snmp.ProxyForwarderImpl.f
orward(ProxyForwarderImpl.java:90)
20:20:15,468 INFO  [STDOUT] 181063 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.agent.mo.snmp.ProxyForwarderImpl.forward(ProxyForwarderImpl.java:90)
20:20:15,468 ERROR [STDERR]     at org.snmp4j.agent.CommandProcessor$ProxyComman
d.run(CommandProcessor.java:518)
20:20:15,468 INFO  [STDOUT] 181063 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.agent.CommandProcessor$ProxyCommand.run(CommandProcessor.java:518)
20:20:15,468 ERROR [STDERR]     at org.snmp4j.util.ThreadPool$TaskManager.run(Th
readPool.java:239)
20:20:15,468 INFO  [STDOUT] 181063 [SMCAgentPool.0] ERROR STDERR  -     at org.s
nmp4j.util.ThreadPool$TaskManager.run(ThreadPool.java:239)



More information about the SNMP4J mailing list