An odd IPv6 application issue
Brian E Carpenter
brian.e.carpenter at gmail.com
Tue Dec 14 02:44:43 CET 2010
As well as java.net.preferIPv6Addresses, there is java.net.preferIPv4Stack.
I may be out of date but I understood that by playing with both of
these you can get appropriate dual stack behaviour.
But if the underlying o/s stack does the wrong thing with
IPv4-Mapped addresses you are definitely hosed. I suspect that
is when you need java.net.preferIPv4Stack quite badly.
On 2010-12-14 13:10, George Bonser wrote:
>> 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
>>> If the destination is v4, open a v4 socket. Don't open a v6 socket
>>> 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