delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/05/05/05:08:56

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=hTUuOVpHI2U8uIiNWmd8ZCGHuaFPCUyltUsAbzJdwtSx/NPk9Nh3N
dnKaR4lerqSBW2MoZ3S+EITeUU2JEFEAt1xkRWlYji9f9Hl51J6LHnyxwtkPNvRh
1SvzzO5Y4nfIvo/BG3IExO/nTJipalHE1YkIe6R8jWNm9/sb7ZwGvM=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=2vNgUGm76LXgAJWekHNferpwh7g=; b=QwCxihMGLlxLVXNi0CVoEb7q9Zjt
0Do7DZpzILi6c7l2Lc9p8ivmVhaKZ1/OFmH+WWxK2H++5lRncS4I7RrHRepG/c7V
ZFI30REDQItvZy3Kg2wG9YQjN5aSai/PJtHz35KOuDmZxMgdsVMgZ0KXkmXPdGeR
gGkf733wUd4LIuE=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Mon, 5 May 2014 11:08:25 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Dup'd sockets lose error information
Message-ID: <20140505090825.GA30918@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20140423142541 DOT 156360 AT gmx DOT com> <20140423153830 DOT GN2339 AT calimero DOT vinschen DOT de> <20140424141444 DOT GR2339 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20140424141444.GR2339@calimero.vinschen.de>
User-Agent: Mutt/1.5.21 (2010-09-15)

--RnlQjJ0d97Da+TV1
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

qq qq?

Ping?

On Apr 24 16:14, Corinna Vinschen wrote:
> On Apr 23 17:38, Corinna Vinschen wrote:
> > On Apr 23 16:25, qq qq wrote:
> > > The following code is a simplified app that was used to test-connect
> > > to local ports 55000+ (none of which were actually listening) and
> > > received false-positive "connected" results because Cygwin's dup()
> > > for socket causes SO_ERROR to be lost. =C2=A0Since FD_SETSIZE is only=
 64 on
> > > Cygwin, the app uses dup()'s to lower the descriptors as it checks
> > > them for completion. =C2=A0There is no such problem on Linux.
> > > Also, strangely that Cygwin does not accept sin_addr as 0 to connect
> > > locally (and either localhost or local host IP must be stuffed in
> > > there, otherwise resulting in the "Cannot assign requested address"
> > > error).
> >=20
> > This is Winsock at work.  Cygwin doesn't check the AF_INET address
> > when calling Winsock's connect, so Winsock's connect itself seems to
> > have this issue.
> >=20
> > As for the SO_ERROR value, I have to check.  Thanks for the testcase.
>=20
> I've applied a patch which should solve both problems.
>=20
> Cygwin is using socket events to implement select.  It turned out that,
> when using the original socket, the socket event as well as the socket's
> SO_ERROR value were set correctly.  However, when calling select with
> the dup'ed socket handle, the socket event contained the correct error
> code, but the SO_ERROR value wasn't set.  I added code to write back the
> error code from the socket event entry to the SO_ERROR socket option and
> that seems to do the trick.
>=20
> As for connecting or sending to INADDR_ANY or in6addr_any, this simply
> doesn't work with Winsock.  It just returns WSAEADDRNOTAVAIL.  I now
> added a conversion from INADDR_ANY and in6addr_any to INADDR_LOOPBACK
> and in6addr_loopback in calls to connect, sendto, and sendmsg to emulate
> the Linux behaviour.
>=20
> Apart from that it turned out that 64 bit Cygwin was suffering from a
> definition problem of a couple of Winsock types used in the Cygwin
> socket code.  As the (hopefully) only user-visible effect, this led
> to a broken address output in /proc/net/if_inet6.  This is fixed now
> as well.
>=20
> As for FD_SETSIZE, it's defined as 64 by default, but the user code
> can override the value by defining FD_SETSIZE to another value prior
> to including the standard headers.  The underlying code does not
> restrict the file descriptor values to < FD_SETSIZE.
>=20
> Please give the today's developer snapshot from=20
> http://cygwin.com/snapshots/ a try.

Any feedback?  Did you test my patch?


Thanks,
Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--RnlQjJ0d97Da+TV1
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJTZ1UJAAoJEPU2Bp2uRE+gaYUP+gLSBQ9y+yG8Uz+uvq0+QTcE
jYj7l34v2mc36YjGtJMg3vwMc8Zz5sKB/Evuvo5g0Uo2GSqYFY7nKVe2uSm0pyuC
zk0TIDfjF43Pc4K6PQvQ4HWuZCxjS/69uAaDXryoWw6j5X35B/wHa/ff8d9mxKKo
B9ZOvEF5k8gkhCTfZ77fptnFZgyDzZOibh85k/PLYUbZVdgza6UPLNUvMUY5UI6P
VJIjqcSpRiiPbEaqIGniLRuIL9KgUaLIhv0sE21U8Sy4jgTJY3NRX0HMSl6rn2XS
QSfpfMBCUdC9fyWHIkjeh12RiwGwygcAnvMUK3Cz2LVoirKENlW8aR7hWQyO10v3
BbdB2ezgfl+BOXs/hCplz6T4vJMgmSOGxNAJCZrVkBQY6BKBiIZHx/4f6VIKOxsJ
Kc1bxMSScdoeRBTggiyGxABDjUCe3Ny0Q244UIzuhq7U42iYaWTy7vWv1lpgsj0f
XyHo/rFaRDUaud0H/kHRP7X3VpsOOdfSFGQ8Nnk1Sj5cGh+tHazPiwoCCbRxKGQ/
3Oxv6nKvc7LIe3UifaREOIy9Jy2LHHzeSY2g6pJzrpMRtzfEA/cp+jJLKcnWseXD
qFmfLR3l5w28ykUuVKF4JpsAM0h0t4pop4E4yMA+HCxjFzD0JNIDWQxRlzUUMRHK
jFi5adN1GDfA5yizrsAi
=J06b
-----END PGP SIGNATURE-----

--RnlQjJ0d97Da+TV1--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019