X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Wed, 12 Aug 2009 17:35:11 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com, cygwin-xfree@cygwin.com
Subject: Re: [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]]
Message-ID: <20090812153511.GD14291@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com, cygwin-xfree@cygwin.com
Mail-Followup-To: cygwin@cygwin.com, cygwin-xfree@cygwin.com
References: <4A78A511.8020109@sipxx.com> <4A803D7C.6070800@dronecode.org.uk> <4A825EE5.5020709@sipxx.com> <4A82BB83.1090908@dronecode.org.uk> <4A82C835.9030504@dronecode.org.uk> <20090812135941.GD13438@calimero.vinschen.de> <4A82DDC1.6050800@dronecode.org.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4A82DDC1.6050800@dronecode.org.uk>
User-Agent: Mutt/1.5.19 (2009-02-20)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Aug 12 16:20, Jon TURNEY wrote:
> On 12/08/2009 14:59, Corinna Vinschen wrote:
>> On Aug 12 14:48, Jon TURNEY wrote:
>>> 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.
>>
>> Thanks for the testcase!
>
> Oh, I meant to say "A couple of small programs shamelessly copied from 
> UNIX Network Programming".  So don't thank me, thank W. Richard Stevens 
> :-)

I already thanked W. Richard Stevens in Cygwin's sources.  He was *the*
network guy for me.  His books and the source codes are invaluable.

I have applied a patch to accept(), btw.  This should now work in the
given scenario.  It occured to me that the returned value is incorrect
for AF_UNIX/AF_LOCAL sockets, but that was always the case and it's not
a regression.  Usually  the peer address of an AF_UNIX socket is not of
interest anyway.  I added that to my TODO list and probably fix that in
a later release.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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

