[1.7] IPv6 accept() fails if address_len is < sizeof(sockaddr_in6) [was Re: PATCH /usr/include/X11/Xtrans/Xtranssock.c [WAS: Re: xhost package not compiled for IPv6]]

Jon TURNEY jon.turney@dronecode.org.uk
Wed Aug 12 13:48:00 GMT 2009


On 12/08/2009 13:54, Jon TURNEY wrote:
> Hmmm... but if it's really the size of the sockname argument which is
> causing the accept() to fail, this would be a bug in cygwin's accept()
> implementation, as it's supposed to truncate the data written to the
> sockname, rather than fail if it won't fit [1]. If that actually is the
> case, since we don't actually use the peer address here, the code as
> stands is correct (if a little odd).
>
> I suppose I need to write a small test case to look at this...
>
> [1] http://www.opengroup.org/onlinepubs/009695399/functions/accept.html

A couple of small programs which hopefully demonstrate this problem.

(As is, the connection fails, but uncommenting the alternate definition of 
cliaddr in listener.c allows it to work)

I'd hazard a guess that perhaps this is because the underlying winsock 
accept() doesn't have this truncate behaviour and considers a too-small 
address_len an error.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: connector.c
URL: <http://cygwin.com/pipermail/cygwin/attachments/20090812/00c074b7/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: listener.c
URL: <http://cygwin.com/pipermail/cygwin/attachments/20090812/00c074b7/attachment-0001.c>
-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list