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=Cx2Yp1fbMjXbjjB2NQIG08zw9QAvAK32a017RC2KK2JEDD2miX/Nf I4YQjYgVOFZJtsNqtXMRUfRScPVxDCrFOPp/J67je2bmn+saSrOWAO7mEfr1deMM Ics/YlQC6eDnMVkkEHm9JjRWb9GGCA7m6JezCrp0R4VdWgB74wexyc= 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=Dt6/TpilwUJz6HoR3anGrH41xSA=; b=kObkJaOumwtR0c1J/QUFNwWFIgFO 41K1Q0fP1379bITVH/fu5lghHN9E2BWwZiu7kNs7sFNsavHqoiW7oK18ZbWAbEzm aVTzzTzN9DGxLjIVsCiK4/xQ21v2QSS5KQ8Wn5MEHgGE6G6KXZxCT7kFCAk4wihg VJQnRn/WnC415XA= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=-101.4 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=DOT, H*F:D*cygwin.com, Maintainer X-HELO: mout.kundenserver.de Date: Thu, 21 Jun 2018 09:19:54 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Problems of AF_INET domain socket regarding out-of-band data. Message-ID: <20180621071954.GA28504@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20180613224858 DOT 7822b08abb75d76b72920095 AT nifty DOT ne DOT jp> <20180620221812 DOT 2e10f95ef5501758493560a2 AT nifty DOT ne DOT jp> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oyUTqETQ0mS9luUI" Content-Disposition: inline In-Reply-To: <20180620221812.2e10f95ef5501758493560a2@nifty.ne.jp> User-Agent: Mutt/1.9.2 (2017-12-15) --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Takashi, (just a sidenote: it would be nice if you would send your patches to the cygwin-patches mailing list) On Jun 20 22:18, Takashi Yano wrote: > Hi Corinna, >=20 > On Wed, 13 Jun 2018 22:48:58 +0900 > Takashi Yano wrote: > > 1. recv() with MSG_OOB flag eats normal data if no OOB data > > is sent yet. > >=20 > > 2. Calling recv() with MSG_OOB flag is blocked if no OOB data > > is sent yet. > >=20 > > 3. Calling recv() without MSG_OOB flag after receiving OOB data > > is blocked even if received data exist in buffer.=20 >=20 > I looked into these problems and found these are due to bug of > cygwin1.dll. >=20 > Problem 1: > If recv() is called with MSG_OOB, in fhandler_socket_inet:: > recv_internal(), wsamsg->dwFlags with MSG_OOB flag set is passed > to WSARecv() and this fails because no OOB data exists. At this time, > wsamsg-> dwFlags is modified by WSARecv() so that it does not have > the MSG_OOB flag. Then, WSARecv() is called again without MSG_OOB > flag in while loop. At this time, normal data is read and returned. >=20 > Problem 2: > In fhandler_socket_inet::recv_internal(), wait_for_events() is > called. This blocks the call until OOB data arrives. >=20 > Problem 3: > If recv() is called with MSG_OOB flag set, fhandler_socket_inet:: > recv_internal() calls wait_for_events() with both FD_OOB and > FD_READ. If both OOB data and normal data already arrived, > not only the event of FD_OOB but also the event of FD_READ are > reset to non signaled state. I'm not sure where the signal is > reset, though. >=20 > Moreover, return value of ioctl command SIOCATMARK of winsock > is not as expected. In winsock, SIOCATMARK returns TRUE if no > OOB data exists, FALSE otherwise. This is almost opposite to > expectation. >=20 > Furthermore, inline mode (SO_OOBINLINE) of winsock is completely > broken. If SO_OOBINLINE is set, SIOATMARK always returns TRUE. > This means application cannot determine OOB data at all in inline > mode. >=20 > To solve these problems, I made a patch attached. >=20 > Could you please have a look? Thanks for the patch. I had a look and your implemantation looks good to me. Two points: - The minor point: There's a typo "oub-of-band" in the comment handling the SO_OOBINLINE ioctl. - The major point: Now that INET and LOCAL sockets are handled separately, we may want to follow Linux' lead: "UNIX domain sockets do not support the transmission of out-of-band data (the MSG_OOB flag for send(2) and recv(2))" (quote from `man 7 unix') If I ever get around to finish the new AF_UNIX implemantation it won't support OOB anyway. For the time being, we may want to disable OOB in fhandler_socket_local already, so, rather than duplicating the changes to AF_INET, we could simply disable OOB handling in fhandler_socket_local entirely. Care to do that? Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --oyUTqETQ0mS9luUI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlsrUZoACgkQ9TYGna5E T6Dx4Q/9GMZ66URYMvfX6AoNWBiocz/5v3VwBAqw50QKoWwY43velnz5pL1YaE+z xp0mrNFJ1prRBIp2D1suFIEPvGbbeDAfQLbHL8qpCtJWJzJu4pkG3RPi9EBvyDdC fVIKX7+zK/BEIKsZyPAZk9X1EpalU241nrNo5nFNFgBf/ENVevPEBYtOuuLRS9nI OBGVwr7yMT2TFOCfsykwRsHvmh0GUIM1p92vKDT0L0HGANRVqdzZkvlTPzF4F/GU lg6lRyCAOtKaPFTbZlfB+pewLcSVWCWIRUXxKnPiA6xU4zfkfAmmUuCY6lDEFoB/ cujooyWhD2fD+3u6VYvYNQ1IYf6MazEOjQoc6ZIepUrw2vzeXLMVNW0qmBMHMGSy qbt6HeH6TxOFf0aPu+WYzdC7zrAl173OXGx0fdn3kEuq1SlDY9ea28vorg4N57th U1uh0zKHuRQ/1MaE+T0/vIZtbbu5FGvDwbe4jn5dh6FeLqYgWCoAJJzoU/Nx1uGV 6RqD26+44ThMNYmkDZOxou9dDsmwRyPyUa6cvd+o7CondMXAdyIJRMgSBbj4YcXE CFY2wW2m/eoRnXQm7/nCCr4aSkHLiTdS2xdEurXr03Lxz8Vxm7fkI3l3onz3EM2L n6hKUKeWNlDM99JlHiWrmisEmWG+oIBoUexUXBzcCDJXllCtAmg= =Hrbj -----END PGP SIGNATURE----- --oyUTqETQ0mS9luUI--