Subject: Re: [mif-arch-dt] Taxonomy

From: "Dapeng Liu" <[email-masked]>
Date: Mon, 3 Jun 2013 22:42:07 +0800

Application can specify preference between IPv4 and IPv6 using Java API, for
example:

System.setProperty("java.net.preferIPv4Stack", "true");

System.setProperty("java.net.preferIPv6Addresses", "true");

Maybe this can be used to implement happy eyeball.

From: [email-masked] [mailto:[email-masked]] On
Behalf Of Ted Lemon
Sent: Wednesday, May 29, 2013 11:43 PM
To: Lorenzo Colitti
Cc: Margaret Wasserman; [email-masked]; Hui Deng; Dmitry Anipko
Subject: Re: [mif-arch-dt] Taxonomy

On May 29, 2013, at 8:26 AM, Lorenzo Colitti <[email-masked]> wrote:

For clients they mostly Just Work. Virtually all apps on android use them,
for example; in fact, in Java it's basically required for things to work,
because in Java you can create a socket and do stuff to it without
specifying the address family, and the only way to do that in a library
without large amounts of lying to the application is to create a dual-stack
socket when the application does "new Socket();".

Cool, this is good to know.   Has this been successful in dual-stack
environments with brokenness?   My expectation would be that this would make
happy eyeballs-like stuff difficult to implement, although if the stack did
some of the probing for you that would certainly ameliorate that concern.

---

From: Lorenzo Colitti <[email-masked]>
Date: Mon, 3 Jun 2013 23:46:35 +0900

On Thu, May 30, 2013 at 12:42 AM, Ted Lemon <[email-masked]> wrote:

>  For clients they mostly Just Work. Virtually all apps on android use
> them, for example; in fact, in Java it's basically required for things to
> work, because in Java you can create a socket and do stuff to it without
> environments with brokenness?   My expectation would be that this would
> make happy eyeballs-like stuff difficult to implement, although if the
> stack did some of the probing for you that would certainly ameliorate that
> concern.
>

I think all the browsers use dual-stack sockets. It's much more convenient
when you have to maintain a pool of sockets and don't know in advance what
you're connecting to. There's no reason you can't implement happy eyeballs
on two dual-stack sockets - remember, a dual-stack socket can connect to an
IPv4 host just like an IPv4 socket.

As regards happy eyeballs, well, that is difficult to implement because of
its very nature. IMO happy eyeballs is a complexity-adding hack that came
into being to solve a specific problem - broken IPv6 connectivity. Now that
that problem is slowly solving itself, we should be working on removing it,
not on perpetuating it.

---

From: Lorenzo Colitti <[email-masked]>
Date: Mon, 3 Jun 2013 23:50:02 +0900

On Mon, Jun 3, 2013 at 11:42 PM, Dapeng Liu <[email-masked]>wrote:

> Application can specify preference between IPv4 and IPv6 using Java API,
> for example:****
>
> ** **
>
> System.setProperty("java.net.preferIPv4Stack", "true");****
>
> System.setProperty("java.net.preferIPv6Addresses", "true");****
>
> ** **
>

No, it can't, because Java doesn't even implement fallback. If you set
preferIPv4Stack it disables IPv6 completely. If you set
preferIPv6Addresses, it tries IPv6 first, but even if the connection fails
quickly and cleanly (e.g., because you don't have IPv6, or because the
remote host sent you a RST), then the connection fails without falling back
to IPv4.

Android gets around this by specifying AI_ADDRCONFIG when calling
getaddrinfo and by hacking the socket library so new Socket("www.ietf.org",
80) will attempt to connect to all www.ietf.org's IP addresses in order.
But this is not the way Java behaves.

---

From: "Dapeng Liu" <[email-masked]>
Date: Tue, 4 Jun 2013 21:32:08 +0800

From: [email-masked] [mailto:[email-masked]] On
Behalf Of Lorenzo Colitti
Sent: Monday, June 03, 2013 10:50 PM
To: Dapeng Liu
Cc: Margaret Wasserman; [email-masked]; Hui Deng; Ted Lemon; Dmitry
Anipko
Subject: Re: [mif-arch-dt] Taxonomy

On Mon, Jun 3, 2013 at 11:42 PM, Dapeng Liu <[email-masked]>
wrote:

No, it can't, because Java doesn't even implement fallback. If you set
preferIPv4Stack it disables IPv6 completely. If you set preferIPv6Addresses,
it tries IPv6 first, but even if the connection fails quickly and cleanly
(e.g., because you don't have IPv6, or because the remote host sent you a
RST), then the connection fails without falling back to IPv4.

How about this:

First, turn on IPv6 and try to establish connection using IPv6, if it fails:

then turn on IPv4 and try to establish connection using IPv4

Is this happy eyeball?

Android gets around this by specifying AI_ADDRCONFIG when calling
getaddrinfo and by hacking the socket library so new Socket("www.ietf.org",
80) will attempt to connect to all www.ietf.org's IP addresses in order. But
this is not the way Java behaves.

---

From: Lorenzo Colitti <[email-masked]>
Date: Tue, 4 Jun 2013 23:33:00 +0900

On Tue, Jun 4, 2013 at 10:32 PM, Dapeng Liu <[email-masked]>wrote:

> How about this:
>
> First, turn on IPv6 and try to establish connection using IPv6, if it
> fails:****
>
> then turn on IPv4 and try to establish connection using IPv4****
>
> Is this happy eyeball?
>

The preference applies to all sockets in the app. So If your app only
establishes one connection at a time, it might work. In something like a
browser that has to establish multiple connections at the same time, it
would be complex and slow.