Bug 8184 - Xtranssock.c:SocketINETGetAddr: (remote display) getsockname does not fill sockaddr_in structure correct in 64 bit mode
Summary: Xtranssock.c:SocketINETGetAddr: (remote display) getsockname does not fill so...
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/xtrans (show other bugs)
Version: 7.1 (2006.05)
Hardware: SPARC Solaris
: high normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on: 728
Blocks:
  Show dependency treegraph
 
Reported: 2006-09-08 02:01 UTC by Michael Lindig
Modified: 2009-09-01 08:24 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Michael Lindig 2006-09-08 02:01:28 UTC
uname -a : SunOS serv5 5.8 Generic_117350-36 sun4u sparc SUNW,Sun-Fire-V440 Solaris
gcc      : Version 4.1.1
ld       : Solaris linker

In 64-bit mode (gcc-options: -mcpu=ultrasparc -m64] the getsockname function
does not fill the sockaddr_in structure correct:

the socknamev4.sin_family is allways 0 (only if you call bzero(socknamePtr,
namelen); before getsockname) instead of AF_INET. Thats why the ciptr->family
will be set to 0 and the ConvertAddress function will fail for remote displays!

Here is a truss log snip (by starting xeyes to a remote DISPLAY) (the truss
interprets the sockaddr_in structure correct):

5.2174	    -> libX11:_X11TransOpenCOTSClient(0xffffffff7fffe780, 0x0, 0x0, 0x0)
 5.2177	    -> libX11:_X11TransOpen(0x1, 0xffffffff7fffe780, 0x0, 0x0)
 5.2181	      -> libX11:_X11TransParseAddress(0xffffffff7fffe780,
0xffffffff7fffe3e8, 0xffffffff7fffe3e0, 0xffffffff7fffe3d8)
 5.2183	      <- libX11:_X11TransParseAddress() = 1
 5.2185	      -> libX11:_X11TransSocketOpenCOTSClient(0xffffffff7ec12b08,
0x10010b9c0, 0x10010b9a0, 0x10010bfe0)
 5.2186	      -> libX11:_X11TransSocketOpenCOTSClientBase(0xffffffff7ead1768,
0x10010b9c0, 0x10010b9a0, 0x10010bfe0)
 5.2188	        -> libX11:_X11TransSocketOpen(0x1, 0x2, 0x0, 0x0)
 5.2191	so_socket(26, 2, 0, "", 1)			= 3
 5.2193	setsockopt(3, 6, 1, 0xFFFFFFFF7FFFE23C, 4, 1)	= 0
 5.2194	        <- libX11:_X11TransSocketOpen() = 0x10010ff90
 5.2196	      <- libX11:_X11TransSocketOpenCOTSClient() = 0x10010ff90
 5.2197	    <- libX11:_X11TransOpenCOTSClient() = 0x10010ff90
 5.2198	    -> libX11:_X11TransConnect(0x10010ff90, 0xffffffff7fffe780, 0x0, 0x0)
 5.2201	      -> libX11:_X11TransParseAddress(0xffffffff7fffe780,
0xffffffff7fffe3e8, 0xffffffff7fffe3e0, 0xffffffff7fffe3d8)
 5.2204	      <- libX11:_X11TransParseAddress() = 1
 5.2205	      -> libX11:_X11TransSocketINETConnect(0x10010ff90, 0x10010ba20,
0x10010ba00, 0xffffffff7fffe3d8)
 5.2207	close(3)					= 0
 5.2208	        -> libX11:_X11TransSocketOpenCOTSClientBase(0xffffffff7ead1768,
0xffffffff7ead1768, 0x10010ba20, 0xffffffff7fffe2b8)
 5.2210	          -> libX11:_X11TransSocketOpen(0x2, 0x2, 0x0, 0x0)
 5.2214	so_socket(2, 2, 0, "", 1)			= 3
 5.2215	setsockopt(3, 6, 1, 0xFFFFFFFF7FFFDEFC, 4, 1)	= 0
 5.2216	          <- libX11:_X11TransSocketOpen() = 0x100110130
 5.2218	        <- libX11:_X11TransSocketOpenCOTSClientBase() = 0x100110130
 5.2220	setsockopt(3, 65535, 8, 0xFFFFFFFF7FFFE308, 4, 1) = 0
 5.2225	connect(3, 0x10010BFC0, 16, 1)			= 0
	AF_INET  name = 153.96.104.208  port = 6000
 5.2227	getsockname(3, 0xFFFFFFFF7FFFE088, 0xFFFFFFFF7FFFE308, 1) = 0
	AF_INET  name = 153.96.104.208  port = 6000
 5.2229	getpeername(3, 0xFFFFFFFF7FFFE2D8, 0xFFFFFFFF7FFFE308, 1) = 0
	AF_INET  name = 153.96.104.208  port = 6000
 5.2230	      <- libX11:_X11TransSocketINETConnect() = 0
 5.2232	    <- libX11:_X11TransConnect() = 0
 5.2234	    -> libX11:_X11TransGetPeerAddr(0x10010ff90, 0xffffffff7fffe86c,
0xffffffff7fffe868, 0xffffffff7fffe848)
 5.2235	    <- libX11:_X11TransGetPeerAddr() = 0
 5.2236	    -> libX11:_X11TransConvertAddress(0xffffffff7fffe86c,
0xffffffff7fffe868, 0xffffffff7fffe848, 0xffffffff7fffe848)
_X11Trans 5.2238	write(2, " _ X 1 1 T r a n s", 9)		= 9
ConvertAddress: Unknown family type  5.2239	write(2, " C o n v e r t A d d r
e".., 36)	= 36
0
 5.2240	write(2, " 0\n", 2)				= 2
 5.2240	    <- libX11:_X11TransConvertAddress() = -1

I did a dirty hack in the function ConvertAddress and changed the case switch
"case AF_INET:" to "case 0: case AF_INET:" to solve this for me!

Example for bash:
 DISPLAY="irgendwo:0" LD_LIBRARY_PATH_64="path-to-XORG-64-bit-libs"
/path/to/xorg/64-bit/app/xeyes

My results on console:
_X11TransConvertAddress: Unknown family type 0
_X11TransConvertAddress: Unknown family type 0
_X11TransConvertAddress: Unknown family type 0
_X11TransConvertAddress: Unknown family type 0
_X11TransConvertAddress: Unknown family type 0
_X11TransConvertAddress: Unknown family type 0
Error: Can't open display: tord:0
Comment 1 Daniel Stone 2007-02-27 01:33:28 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 2 Alan Coopersmith 2009-09-01 08:24:57 UTC
This should be fixed in current git/releases by a bugfix made last year:

commit ac13a1a34b61247a21da130f0ba9922f35d3dc3b
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date:   Tue Apr 15 12:32:35 2008 -0700

    Sun bug #6688467: _X11TransConvertAddress: Unknown family type on 64-bit SPARC
    
    Check for socklen_t definition and if found use it instead of size_t or
    int for the length argument to getpeername/getsockname/etc.
    
    <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6688467>


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.