Bug 287 - xdm won't run on non-IPv6 system if built with IPv6 support
Summary: xdm won't run on non-IPv6 system if built with IPv6 support
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high major
Assignee: Default Bug Report Assignee
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 213
  Show dependency treegraph
 
Reported: 2004-03-08 08:30 UTC by Alan Coopersmith
Modified: 2004-03-10 15:08 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch for some of the problems provided by Peter Breitenlohner (1.68 KB, patch)
2004-03-08 08:30 UTC, Alan Coopersmith
no flags Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Coopersmith 2004-03-08 08:30:08 UTC
Reported by Peter Breitenlohner <peb@mppmu.mpg.de> in a thread on devel@XFree86.org:

> I fully understand that XFree86 has to support IPv6. The current
> implementation has, however, a serious flaw: when compiled with IPv6 support
> (which is the default for most linux/gnu systems) the progams implicitly
> assume that IPv6 is supported by the kernel. In our case that is not so, and
> in order to get things working I had to
> 	#define BuildIPv6		NO
> in xc/config/cf/host.def, thereby permanantly disabling IPv6 support.

> It would be extremely helpful if one could compile XFree86 with IPv6
> support, but then disable IPv6 at runtime via configuration files
> (resources) and/or command line options (in order to avoid various
> timeouts), and the programs should automatically fall back to IPv4 in case
> IPv6 is not supported by the kernel.

> The actual problems encountered were twofold:

> 1. xdm produced an error message
> 	chooser socket creation failed
> and there was just a useless parent process but no child process(es) and no
> Xserver was started. I think the lines 69ff in xc/programs/xdm/socket.c
> 	#if defined(IPv6) && defined(AF_INET6)
> 	    chooserFd = socket (AF_INET6, SOCK_STREAM, 0);
> 	#else
> 	    chooserFd = socket (AF_INET, SOCK_STREAM, 0);
> 	#endif
> ought to be
> 	#if defined(IPv6) && defined(AF_INET6)
> 	    chooserFd = socket (AF_INET6, SOCK_STREAM, 0);
> 	    if (chooserFd == -1)
> 	#endif
> 	    chooserFd = socket (AF_INET, SOCK_STREAM, 0);
> although I haven't tested this.

> 2. Trying to start chooser by hand lead to a segmentation fault! With a
> little tracing I found the following code in xc/programs/xdm/chooser.c in
> lines 844ff
> 	#if defined(IPv6) && defined(AF_INET6)
> 	    socket6FD = socket (AF_INET6, SOCK_DGRAM, 0);
> 	#endif
> and later in lines 856ff
> 	    XtAddInput (socketFD, (XtPointer) XtInputReadMask, ReceivePacket,
> 			(XtPointer) &socketFD);
> 	#if defined(IPv6) && defined(AF_INET6)
> 	    XtAddInput (socket6FD, (XtPointer) XtInputReadMask, ReceivePacket,
> 			(XtPointer) &socket6FD);
> 	#endif
> The second code fragment certainly ought to be
> 	    XtAddInput (socketFD, (XtPointer) XtInputReadMask, ReceivePacket,
> 			(XtPointer) &socketFD);
> 	#if defined(IPv6) && defined(AF_INET6)
> 	    if (socket6FD != -1)
> 	    XtAddInput (socket6FD, (XtPointer) XtInputReadMask, ReceivePacket,
> 			(XtPointer) &socket6FD);
> 	#endif
> but that may not suffice. Calling XtAddInput with a untested first argument
> is just asking for serious trouble.
Comment 1 Alan Coopersmith 2004-03-08 08:30:59 UTC
Created attachment 133 [details] [review]
Patch for some of the problems provided by Peter Breitenlohner
Comment 2 Alan Coopersmith 2004-03-09 17:20:47 UTC
The fixes look reasonable to me, but I don't have a system that I can remove IPv6
support from to test on, so I don't know if they fix all the problems.

Unfortunately, when originally developing the IPv6 changes I did so on Solaris,
where if you had IPv6 support at compile time, you had it at run time, so I didn't
include fallbacks to AF_INET if AF_INET6 failed, but probably should have for 
systems like Linux without such a guarantee.
Comment 3 Egbert Eich 2004-03-11 10:08:25 UTC
Scheduled for commit to RELEASE-1 branch.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.