The format is probably wrong:
Address targetAddress =
GenericAddress.parse("udp:<HostName>:<TrapReceiverPort>/162");
Correct would be:
Address targetAddress =
GenericAddress.parse("udp:<HostName>/<TrapReceiverPort>");
Frank
Am 07.03.2013 01:18, schrieb Hallur,Parashuram:
Frank:
Could you please answer my follow up questions?
I may attempt test program today my day time.
Thanks,
Parash
On Wed, Mar 6, 2013 at 6:50 PM, Hallur,Parashuram <[email protected]>wrote:
Frank:
Thanks again for your response. I'm sorry if I was unclear.
Let me add little more elaboration.
1. With snmp4j-1.0.jar : Application is bind to IPv6 socket address.
In this case trying to send the trap fails with the
java.nio.BufferOverFlowException is thrown.
2. With snmp4j-2.0.jar : Application is bind to all machine IP addresses.
Here the application is running/listening on dual stack mode.
In this case I get the "UnknownHostException" while parsing the target
address.
3. With snmp4j-2.0.jar : Application is bind to only IPv6 socket address.
The application is running/listening on IPv6 only address
In this case also, I get the "UnknownHostException" while parsing the
target address
A question about the address parsing
This piece of code works for the application running on Ipv6 only, which
tries to send the trap?
Address targetAddress =
GenericAddress.parse("udp:<HostName>:<TrapReceiverPort>/162");
I will make an attempt to write test program and let you know how it goes.
Thanks,
Parash
On Wed, Mar 6, 2013 at 6:35 PM, Frank Fock <[email protected]> wrote:
Hi Parash,
The scenario with the three cases you described below does not make any
sense to me.
With "the application is bind to an address" you probably mean, the
SNMP4J listen
address. If so, this could not relate to the exception of case 1.
Regarding case 2 and 3, seems to be simply a wrong target address and is
unrelated to
the local address SNMP4J is bound too.
I think you should investigate this further and write a small - only
SNMP4J based application
that reproduces the error. I do not think that we can get any progress
otherwise.
Best regards,
Frank
Am 06.03.2013 09:27, schrieb Hallur,Parashuram:
Reposting the complete thread with currect subject
-------------------------------------------------------------------------
Hi Frank:
As I mentioned in my original email, the host is not getting recognized,
it throws the "UnknownHostException" at the
InetAddress.getByName("HostName"). The reason is the host name will be sent
by snmp4j as "localhost:1622" to this underneath api, ideally it should not
be sent with the trap receiver port. I tried this both for IPv4 and IPv6
address application, in both cases I see the same issue with snmp4j-2.0.jar.
My application is configurable to bind to particular address, it can be
configured to bind to single socket address or multiple socket addresses.
Following are the cases I tried
1. With snmp4j-1.0.jar : Application is bind to IPv6 socket address, the
java.nio.BufferOverFlowException is thrown.
2. With snmp4j-2.0.jar : Application is bind to all machine IP addresses.
"UnknownHostException" while parsing the target address
3. With snmp4j-2.0.jar : Application is bind to only IPv6 socket address.
"UnknownHostException" while parsing the target address
The code used to parse the address is -
Address targetAddress =
GenericAddress.parse("udp:<HostName>:<TrapReceiverPort>/162");
Am I missing something here? Appreciate your help very much. Please let
me know if you need more details.
Thanks,
Parash
--------
OK, that'a no problem. So then why do you get an exception?
Am 06.03.2013 01:15, schrieb Hallur,Parashuram:
--------
Thank you so much for the response Frank.
What do you exactly mean by "trap is bound to IPv6 address"?
This means, the application which is running on IPv6 address is trying to
send a notification to the trap receiver running on a dual stack IP ( both
Ipv4 & IPv6 )mode machine.
Thanks,
Parash
----------
Hi Parash,
What do you exactly mean by "trap is bound to IPv6 address"?
(If you tried to set the agentAddress field in a trap/notification with a
IPv6 address
you will fail, as SNMP supports IPv4 addresses only for this field.
Best regards,
Frank
Am 06.03.2013 01:05, schrieb Hallur,Parashuram:
On Wed, Mar 6, 2013 at 5:39 AM, Hallur,Parashuram <[email protected]>wrote:
Frank or any body else on the forum:
Would you please help me with pointers on how to fix this issue? What
needs to be done to be able to send the traps from IPv6 application?
Thanks for any pointers.
Parash
On Tue, Mar 5, 2013 at 7:24 AM, Hallur,Parashuram <[email protected]>wrote:
Thanks Frank for the response. Yes the application which is trying
to send the trap is bound to IPv6 address, would you please help me with
how to fix this issue?
Thanks,
Parash
On Mon, Mar 4, 2013 at 11:44 PM, Frank Fock <[email protected]> wrote:
Hi,
I think you are trying to sent an IPv6 address as IpAddress BER encoded
on the wire. This is not possible, because the SNMP standard defines
IpAddress as IPv4 address and nothing else.
If this worked with 1.0 then this was an error in 1.0.
Best regards,
Frank
Am 04.03.2013 12:24, schrieb Hallur,Parashuram:
Hi,
I'm using the following code to create the target address.
Address targetAddress =
GenericAddress.parse("udp:<HostName>:<TrapReceiverPort>/162");
This goes through fine when I use the snmp4j1.0.jar. However, this
particular version seems does not support the IPv6 addresses. For IPv6
requests it throws the java.nio.BufferOverFlowException.
java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Unknown Source)
at java.nio.HeapByteBuffer.put(Unknown Source)
at org.snmp4j.asn1.BEROutputStream.write(BEROutputStream.java:65)
at org.snmp4j.asn1.BER.encodeOID(BER.java:437)
at org.snmp4j.smi.OID.encodeBER(OID.java:205)
at
org.snmp4j.smi.VariableBinding.encodeBER(VariableBinding.java:176)
at org.snmp4j.PDUv1.encodeBER(PDUv1.java:207)
at org.snmp4j.mp.MPv1.prepareOutgoingMessage(MPv1.java:108)
at
org.snmp4j.MessageDispatcherImpl.sendPdu(MessageDispatcherImpl.java:376)
at org.snmp4j.Snmp.sendMessage(Snmp.java:900)
at org.snmp4j.Snmp.send(Snmp.java:779)
at org.snmp4j.Snmp.send(Snmp.java:771)
To fix the above issue, I picked up the latest jars snmp4j2.1.0.jar,
snmp4j1.11.3.jar, and snmp4j1.10.jar. All of these throw the unknown
host
exception. What I notice is that snm4j sends hostname as
"hostname:trapreceiverport" to underneath java api to resolve the
address,
hence the issue unknownhostexception. The same code works with 1.0
version
of jar. Are there any difference from now and then? Any help is very
much
appreciated.
Thanks,
Parash
_______________________________________________
SNMP4J mailing list
[email protected]
http://lists.agentpp.org/mailman/listinfo/snmp4j
--
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax: +49 7024 8688231
_______________________________________________
SNMP4J mailing list
[email protected]
http://lists.agentpp.org/mailman/listinfo/snmp4j
_______________________________________________
SNMP4J mailing list
[email protected]
http://lists.agentpp.org/mailman/listinfo/snmp4j
--
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax: +49 7024 8688231
_______________________________________________
SNMP4J mailing list
[email protected]
http://lists.agentpp.org/mailman/listinfo/snmp4j