[plt-scheme] IPv6 and Linux (was: web-server and IPv6?)

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Nov 11 14:55:52 EST 2005

At Mon, 7 Nov 2005 16:31:39 -0500, Doug Orleans wrote:
> I can't seem to get the web-server to run using the SVN trunk code:
> 
> dro:/home/web# web-server-text
> tcp-listen: listen on 80 failed (Address family not supported by protocol; 
> errno=97)

I've fixed this for v299.206.

There are a couple of problems with Linux:

 * When IPv6 support is disabled, getaddrinfo() still responds with
   IPv6 addresses in the list of defaults.

 * IPv6 and IPv4 listeners cannot be bound to the same port unless the
   IPv6 listener is specified to accept only IPv6 connections. The
   relevant IPv6 option is not supported by Linux 2.4.20 and earlier.

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.

I don't like #2, because it means that specifying "localhost" for the
hostname is different from specifying no host. Still, I prefer this #2
to the option of ignoring all IPv6 failures. Other suggestions are
welcome.

Matthew



Posted on the users mailing list.