[plt-scheme] IPv6 and Linux (was: web-server and IPv6?)
I've changed `tcp-listen' for Linux one more time, so let me know if
you see any problems.
Details below...
At Fri, 11 Nov 2005 12:55:52 -0700, Matthew Flatt wrote:
> My solutions:
>
> 1. For Linux 2.4.20 and earlier, `tcp-listen' uses only IPv4 mappings.
>
> 2. For Linux 2.4.21 and later, `tcp-listen' uses only IPv4 mappings
> when no hostname is supplied.
>
> 3. For Linux 2.4.21 and later, when `tcp-listen' creates an IPv6
> listener (because a given hostname maps to an IPv6 address), the
> listener accepts only IPv6 connections.
This biggest problem with this approach is that it relies on
compile-time detection of the kernel version.
In the new approach, `tcp-listen' takes special action only when the
listener has both IPv4 and IPv6 addresses:
* If IPv6 sockets can't be created due to EAFNOSUPPORT, or if the
IPV6_V6ONLY socket option doesn't work (which means Linux 2.4.20 and
earlier), then the IPv6 addresses are silently(!!!) ignored.
* Otherwise, IPv6 sockets for the listener accept only IPv6
connections --- though you normally can't tell, since having both
IPv4 and IPv6 addresses probably means that there's an IPv4 address
for the same interface.
Of course, I don't like silently ignoring IPv6 addresses, but it seems
like a better compromise than the old one. These rules do not apply you
specify an IPv6-only address like "::1", so if that fails, then you see
the error.
Matthew