Bug: Server2Server not working with IPv6 @ OpenFire 3.9.1

Hi,

I’m having a problem with OpenFire 3.9.1 on a Debian7 System running with Java 1.7.0_40 Oracle Corporation – Java HotSpot™ 64-Bit Server VM (more details provideable).

My Server uses a dualstack setup with IPv4 and IPv6. The file /etc/resolv.conf contains several IPv4 DNS Servers and two IPv6 servers as well.

nameserver config

nameserver 2xx.xxx.yyy.99

nameserver 2xx.xxx.yyy.100

nameserver 2xx.xxx.yyy.98

nameserver 8.8.8.8

nameserver 8.8.4.4

#nameserver 2axx:yyy:0:zzzz::add:9898

#nameserver 2axx:yyy:0:zzzz::add:9999

#nameserver 2axx:yyy:0:zzzz::add:1010

(x, y and z’s inserted for obfuscation of real IPs )

This gives the following errors in the error.log file:

2014.02.20 19:18:39 org.jivesoftware.openfire.session.LocalOutgoingServerSession - Error authenticating domain with remote server: gmail.com

java.lang.NumberFormatException: For input string: “yyy:0:zzzz::add:9898”

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

at java.lang.Integer.parseInt(Integer.java:492)

at java.lang.Integer.parseInt(Integer.java:527)

at com.sun.jndi.dns.DnsClient.(DnsClient.java:122)

at com.sun.jndi.dns.Resolver.(Resolver.java:61)

at com.sun.jndi.dns.DnsContext.getResolver(DnsContext.java:570)

at com.sun.jndi.dns.DnsContext.c_getAttributes(DnsContext.java:430)

at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContex t.java:231)

at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompos iteDirContext.java:139)

at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompos iteDirContext.java:127)

at javax.naming.directory.InitialDirContext.getAttributes(InitialDirContext.java:1 42)

at org.jivesoftware.openfire.net.DNSUtil.srvLookup(DNSUtil.java:192)

at org.jivesoftware.openfire.net.DNSUtil.resolveXMPPDomain(DNSUtil.java:124)

at org.jivesoftware.openfire.session.LocalOutgoingServerSession.createOutgoingSess ion(LocalOutgoingServerSession.java:270)

at org.jivesoftware.openfire.session.LocalOutgoingServerSession.authenticateDomain (LocalOutgoingServerSession.java:167)

at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.sendPa cket(OutgoingSessionPromise.java:261)

at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.run(Ou tgoingSessionPromise.java:238)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:724)

So, the first part of the address is missing - it seems the IPv6 address is being interpreted as IPv4 + Port or something like that.

After I removed the IPv6 addresses from resolv.conf, everything works as expected - but thats not a real solution for me.

Is this a bug? How can this behaviour be fixed?

Thanks!

java.lang.NumberFormatException: For input string: “yyy:0:zzzz::add:9898”

Probably not a “bug” per-say, but rather an enhancement/feature request. From this exception, it appears Openfire is attempting to validate your IP address… since ipv4’s are all numbers, they likely are checking if its a number. Since ipv6 is hexdecimal and can contain the letters a-f, then obviously this is not a number and it throws the above exception.

Does this cause your Openfire server to not work? Or, is this just an error in the logs?

Why does it seem like it is validating MY ip?

The message clearly states that this exception happended while it was resolving gmail.com.

The stated IPv6 address is the address of one of my IPv6 DNS Resolvers.

It causes my server to stop working as outgoing and incoming connections to external servers are not possible (e.g. chat with people on different servers are not possible).

And in my understanding this IS a bug since OpenFire is supposed to work on IPv6 systems but fails to work on IPv6 Resolvers.

Correct me if I’m wrong

And in my understanding this IS a bug since OpenFire is supposed to work on IPv6 systems but fails to work on IPv6 Resolvers.
Yes, but it’s not an Openfire bug, it’s a bug in the Java implementation. It happens when the Java runtime tries to parse a resolv.conf which contains IPv6 addresses as nameservers. Maybe it helps if you enclose the addresses in square brackets, e.g.

nameserver [2axx:yyy:0:zzzz::add:9898]

java.lang.NumberFormatException: For input string: “yyy:0:zzzz::add:9898”

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

at java.lang.Integer.parseInt(Integer.java:492)

at java.lang.Integer.parseInt(Integer.java:527)

at com.sun.jndi.dns.DnsClient.(DnsClient.java:122)

at com.sun.jndi.dns.Resolver.(Resolver.java:61)

at com.sun.jndi.dns.DnsContext.getResolver(DnsContext.java:570)

The stacktrace clearly shows that it’s not Openfire, i.e. Openfire code, that is throwing the exception. See also [#JDK-6991580] IPv6 Nameservers in resolv.conf throws NumberFormatException - Java Bug System