public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Bug at getsockopt when TCP_NODELAY is used as parameter
Date: Mon, 05 May 2014 12:35:00 -0000	[thread overview]
Message-ID: <20140505123459.GJ30918@calimero.vinschen.de> (raw)
In-Reply-To: <535CC856.7050808@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1534 bytes --]

Hi Jorge,

On Apr 27 11:05, jdzstz wrote:
> 
> 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 ==
sizeof(BOOL) == 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) == 4, or sizeof(DWORD) == 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

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

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-05-05 12:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CA+wAnvyrB2ecwdJsvzqmMNjPFTnW6rT0rYdNcXRbK4z5WJqwyg@mail.gmail.com>
2014-04-27  9:05 ` jdzstz
2014-05-05 12:35   ` Corinna Vinschen [this message]
2014-05-05 15:28     ` Corinna Vinschen
2014-05-06 22:44       ` jdzstz
2014-05-07  7:51         ` Corinna Vinschen
2014-05-08 21:14           ` jdzstz
2014-07-24 12:22 ` Bug executing "write" at Cygwin 1.7.31-2 jdzstz
2014-07-24 13:41   ` Corinna Vinschen
2014-07-25  8:47     ` jdzstz
2014-07-25 12:37       ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140505123459.GJ30918@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).