X-Recipient: archive-cygwin@delorie.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=behQj2P1HSEykPlzUSBU7ybIupGTw7UYY1jlnT+yMhMLTIA96IiEc
	h9E07as/S7kg4XnMSszFAQCsSYRpO5Ac5Bg13VlBHYVbOF+h3Ew/au5Qiv02lplJ
	YPhbsvl5weDeWw8Xvd1pcXuzM7pWAHaP6/ecSpC4e919F5hrs4o1SY=
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=pd8djDOK5qlLZT02PmVpetjZ5Hc=; b=EHE2W1c+uXqOF+gfGWVScSPwjtdx
	1bHgTytlyW/3XsXlji2IiWfrKmFIf+y8yDqwWQRCLiUWV1/QXLCP3sg8XI6d6nMz
	yfoJ5Dn4gOR+uJ/cTXB+Qt/vCFkxXGwtRbGSDvXS8LCWUDvQrGiabsmSOZbIvTvI
	TftarEg30e0MPvE=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.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
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 14:34:59 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Bug at getsockopt when TCP_NODELAY is used as parameter
Message-ID: <20140505123459.GJ30918@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <CA+wAnvyrB2ecwdJsvzqmMNjPFTnW6rT0rYdNcXRbK4z5WJqwyg@mail.gmail.com> <535CC856.7050808@gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;	protocol="application/pgp-signature"; boundary="dMdWWqg3F2Dv/qfw"
Content-Disposition: inline
In-Reply-To: <535CC856.7050808@gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)

--dMdWWqg3F2Dv/qfw
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Jorge,

On Apr 27 11:05, jdzstz wrote:
>=20
> While compiling varnish 3.0.5, I have detected a possible bug at
> getsockopt when TCP_NODELAY is used as parameter. The issue is
> caused because at cygwin it returns a BOOL, instead returning INT
> value like at Linux.

It's worse.  Officially these socket options return with an optlen =3D=3D
sizeof(BOOL) =3D=3D sizeof(int).  If you look into all MSDN manual pages
related to getsockopt/setsockopt and their supported socket options,
they claim that the size of the options returning a boolean value are
sizeof(BOOL) =3D=3D 4, or sizeof(DWORD) =3D=3D 4.  And that's what they did
up to and including Windows XP and Windows 2003.

Only, starting with Windows Vista, getsockopt suddenly returned with
optlen set to 1, which is sizeof(BOOLEAN), the boolean type used by the
underlying kernel.  And this has never been fixed again.

Cygwin already handles this problem by converting the value to a
sizeof(int) value and changing optlen accordingly, but only for the
socket options SOL_SOCKET/SO_KEEPALIVE and SOL_SOCKET/SO_DONTROUTE.

I will fix that at one point, but I have to dig into that a bit more to
see which socket options have to be special-cased, or if this
special-casing can be radically simplified somehow.  Special-casing
dozens of socket options just to tweak the return type isn't exactly
fun.


Corinna

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

--dMdWWqg3F2Dv/qfw
Content-Type: application/pgp-signature

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

iQIcBAEBAgAGBQJTZ4VzAAoJEPU2Bp2uRE+gURcP+gOuCi4v7IHzYJ1we4vYN1YM
MyeeP8Df0x4w0UQ1Rq9xRKX+P6qWUZTDmjexs/SuNr72KZwQJdfs75crnXfauXDr
ePRWiBE0kMSk5OkXLMcZbpQopTSBaS+2ux3UVnOwMGLM93fOTs1FyPRQJY/b6Cz9
OHI+xrWqbNReuXEJdpYqQn/gOiI4qXcHMAWCPUNJZd6skCh2ZsqxznokvIzGXgQ7
vI9ZqayuZMQkumiTRePGVhWj5zbJI3OqTNt7A6IbCLQn3jGGzzHBW8pt+PW+1W/B
7OCWSv6y2+HuSv4VSoDd49QJn2YQAStrt/wjAmanZVCp2L8xVOVFUQj7124VdxEk
CWByWp4w5j5knY6hujzMVbS7/yQqBYq6ezAdckkWGbHljNgTJv5h/moXRh+jAVd4
MGTNWtQmeIcVhxP7j+QoBUBLRN5VljLa/zuWV/DXrzawEc53K0tB8dGBEi8x/ldn
Y4j3S9SNKjabvwud5htFX1svi5GFNoPzrLmgujk32AUSoI+C46Rncf+bznj7VBjN
CrvQEytWZDX96qEVPT2Kw/HQoVU69OHjHSRrLHkKdYafpBS2KLsoPxpGKQAUlqse
cEIB+TS9GZoRF3S3eu8S6MYNfP2e6EN7HagQTIl8NsNJtgN93m7lxHZ8aF6dAjZ6
KNUf8tmH+OKlg3xVIILI
=oiK4
-----END PGP SIGNATURE-----

--dMdWWqg3F2Dv/qfw--
