On Tue, 22 Jul 2003, Alan Coopersmith wrote:

> Egbert Eich wrote:
> > When I switch the order of initialization around and skip the IPv4
> > protocol if IPv6 initialization was successful, everything works: 
> > I can connect thru IPv6 and IPv4. 
> 
> This was one of the patches suggested to the X.org IPv6 review which
> we declined to include in our patch set, but which got checked into
> the XFree86 CVS anyway.   We were told that separately binding to both is
> the usual habit on OpenBSD, while simply binding to IPv6 and letting it
> handle both was the way we coded it to work, and had it working on both
> Solaris and Linux.

The source code for exim, a mail transport agent which supports IPv6
on a significant number of platforms, contains the following comment
(in src/daemon.c):

 /* Otherwise we set up things to listen on all interfaces. In an IPv4 world,
 this is just a single, empty address. On systems with IPv6, several different
 implementation approaches have been taken. This code is now supposed to work
 with all of them. The point of difference is whether an IPv6 socket that is
 listening on all interfaces will receive incoming IPv4 calls or not.

 . On Solaris, an IPv6 socket will accept IPv4 calls, and give them as mapped
   addresses. However, if an IPv4 socket is also listening on all interfaces,
   calls are directed to the appropriate socket.

 . On (some versions of) Linux, an IPv6 socket will accept IPv4 calls, and
   give them as mapped addresses, but an attempt also to listen on an IPv4
   socket on all interfaces causes an error.

 . On OpenBSD, an IPv6 socket will not accept IPv4 calls. You have to set up
   two sockets if you want to accept both kinds of call.

 . FreeBSD is like OpenBSD, but it has the IPV6_V6ONLY socket option, which
   can be turned off, to make it behave like the versions of Linux described
   above.

 . I heard a report that the USAGI IPv6 stack for Linux has implemented
   IPV6_V6ONLY.

So, what we do is as follows:

 (1) At this point we set up two addresses, one containing ":" to indicate
 an IPv6 wildcard address, and an empty one to indicate an IPv4 wildcard
 address.

 (2) Later, when we create the IPv6 socket, we set IPV6_V6ONLY if that option
 is defined.

 (3) We listen on the v6 socket first. If that fails, there is a serious
 error.

 (4) We listen on the v4 socket second. If that fails with the error
 EADDRINUSE, assume we are in the situation where just a single socket is
 permitted, and ignore the error. */


-----------
I'm suprised at how broken the X.Org IPv6 code has proven.

-- 
Andrew C Aitchison

_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to