delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/07/30/06:48:16

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B9C1393D013
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1627642094;
bh=he3hZJM4vYBDR2zUZMMBdoGVslCmZAThQUqoPMuO418=;
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=XlXKpENo3YN/jbJM22j4n23qVRq5nb3QQRttBHvbsqb+/Dfe0cA+VfU1i0nPX2/YH
/cjNJpo05FV4ICV2Uc7E4CssWeClJH4Ld/BKdLOWLPL6HcJjPnvBxWQoPKYzBIhJrF
4ny/rAwVUgwokOohGzKUE9GPqQ+uiVbL56Qap07s=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2B68D3851C33
Date: Fri, 30 Jul 2021 12:47:39 +0200
To: cygwin AT cygwin DOT com
Subject: Re: calls to socket() fail when calling getaddrinfo() with IPPROTO_TCP
Message-ID: <YQPYy+L7KnFXnpOs@calimero.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com, John Scott <jscott AT posteo DOT net>
References: <1f5c0302c156c9391d294ea9df84d93b8742a500 DOT camel AT posteo DOT net>
<YQPHquBoiwj50IdF AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <YQPHquBoiwj50IdF@calimero.vinschen.de>
X-Provags-ID: V03:K1:6DX2D42HH41pBE5aBCZdUoXxQFkMIerlj6KCv4z/neA33TPsSsS
AVNLFHHJSfr6XGvYht38V6yMbgXtpptglg3GjclLW6zno5MajaJzkvGjxA+sWnKnkSouNtJ
IxiLZa6qnwYL0gpoSwy+aEWNR00ddUG60S7qSkdhAo7W5Ot7uJmcZT/xSkYfXEBjrh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DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE,
RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL,
TXREP autolearn=ham autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>,
John Scott <jscott AT posteo DOT net>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On Jul 30 11:34, Corinna Vinschen via Cygwin wrote:
> Yeah, that's a bad joke as well.  The reason is that the http service is
> defined for TCP only.  Not for UDP.  As a result, Windows' getaddrinfo
> suddenly returns a valid ai_socktype field:
> 
>   family: 23 socktype 1 protocol 6	AF_INET6, STREAM, TCP
>   family: 2 socktype 1 protocol 6	AF_INET,  STREAM, TCP

Just to be precise here, the fact that ai_protocol is IPPROTO_TCP
in this example output is only because of your hints.  If you don't
restrict ai_protocol, you'll get:

    family: 23 socktype 1 protocol 0	AF_INET6, STREAM, any
    family: 2 socktype 1 protocol 0	AF_INET,  STREAM, any

> Cygwin implements a shallow (~300 lines) wrapper over the WinSock
> GetAddrInfoW function and otherwise relies on the values returned by the
> OS.  However, it already duplicates the returned list to self-allocated
> memory, which is required for fork(2) semantics.  It should be possible
> to improve the wrapper to duplicate entries with socktype and protocol
> 0-entries, but that would be in the next Cygwin version earliest.

I hacked up a patch which is supposed to do exactly that.  In your case
it now returns

  family: 23 socktype 1 protocol 6
  family: 2 socktype 1 protocol 6

and in case you omit the ai_protocol restriction it returns with

  family: 23 socktype 1 protocol 6
  family: 23 socktype 2 protocol 17
  family: 2 socktype 1 protocol 6
  family: 2 socktype 2 protocol 17

rather than with

  family: 23 socktype 0 protocol 0
  family: 2 socktype 0 protocol 0

I've uploaded a new developer snapshot to https://cygwin.com/snapshots

Please give it a try and report back.


Thanks,
Corinna

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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