Force IPv6 connections in SVNKit - how?

We have SVNKit embedded in a Bamboo agent running on an IPv6 only host.

When SVNKit tries to connect, it tries to do so over IPv4, which doesn’t work, and so SVNkit fails.

I need to know the mechanism used to force SVNKit to use IPv6.

From the trawl of google, I have learned that SVNkit gets it’s configuration from the native subversion command line client. There is nothing that I can find in the docs for the svn command line client that force IPv6.

Does anyone know?

Hello Graham,
we never tried IPv6 and never tested SVNKit with this protocol. On the other hand, SVNKit uses Java virtual machine, which should support IPv6, so there’s a chance that SVNKit already supports IPv6. Even if SVNKit doesn’t support IPv6, probably it’s easy to change it to make support it.

May I ask you some questions that could help us understand your situation better?

  • When you write “SVNKit fails”, what exact message do you see? Or how exactly does it fail? Is there a stack trace of the failure in the log? The stack trace and error message could help a lot.
  • Which SVN protocl are you using? SVNKit supports svn+ssh://, svn://, file://, and http(s)://

Any SVNKit connection is created inside SVNSocketFactory class and I see nothing specific to IPv4 there, except maybe createAddress(String hostName) method which starts with

byte[] bytes = new byte[4];

line. It looks like this method calls InetAddress::getByAddress if the host is IPv4, or InetAddress::getByName (e.g. DNS name) if the host is IPv6.

So from the first glance, it looks like SVNKit lacks IPv6 support in this method but it’s easy to add the support there.

Just to be sure, may I ask you to try the following?

Set

-Djava.net.preferIPv6Addresses=true
-Djava.net.preferIPv4Stack=true

JVM properties? Does it help? Here’s the properties documentation.
I don’t expect this to help, but why not to try?

As a temporary work-around until we support IPv6 in SVNKit, I could propose to add an entry in /etc/hosts, corresponding to your IP address and compose SVN URL using the host. According to
SVNSocketFactory::createAddress source code, InetAddress::getByName will be called, so the correct IPv6 address will be resolved. Does this help?