An odd IPv6 application issue

George Bonser gbonser at seven.com
Tue Dec 14 01:10:37 CET 2010


> From: Francois Tigeot 
> Sent: Saturday, December 11, 2010 2:07 PM
> To: George Bonser
> Cc: ipv6-ops at lists.cluenet.de
> Subject: Re: An odd IPv6 application issue
> 
> On Sat, Dec 11, 2010 at 01:39:45PM -0800, George Bonser wrote:
> >
> > Which is what I think I want.  If the destination is v6, open a v6
> socket.
> > If the destination is v4, open a v4 socket.  Don't open a v6 socket
> that
> > uses mapped v4 addressing (that's just silly, in my opinion).

Ok, I take it all back, I guess it is a "javaism".  Here is what is
going on:

With all the default values, if the socket is bound to a local name and
the name resolves to both a v4 and a v6 address, it uses a mapped v4
source address to talk to a v6 server.

If I set "java.net.preferIPv6Addresses=true" then it will bind locally
to the v6 address and not be able to talk to a v4 only destination but
will talk properly to a v6 destination (gives "network unreachable" when
attempting to open a socket to a v4 host).

So it appears that java is seriously hosed when it comes to ip v6
dual-stack.  It looks like it will work fine in v4 or v6 only modes.
Actually, if Java simply looked at the destination first and used that
to decide which kind of socket to open, everything would be fine.  But
instead it looks at the source binding and decides before it looks at
the destination.





More information about the ipv6-ops mailing list