From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56284 invoked by alias); 31 Jan 2018 09:11:54 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 55887 invoked by uid 89); 31 Jan 2018 09:11:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-101.9 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*R:D*cygwin.com X-HELO: drew.franken.de Received: from mail-n.franken.de (HELO drew.franken.de) (193.175.24.27) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 31 Jan 2018 09:11:02 +0000 Received: from aqua.hirmke.de (aquarius.franken.de [193.175.24.89]) (Authenticated sender: aquarius) by mail-n.franken.de (Postfix) with ESMTPSA id 1DA0C721E280D for ; Wed, 31 Jan 2018 10:10:54 +0100 (CET) Received: from calimero.vinschen.de (calimero.vinschen.de [192.168.129.6]) by aqua.hirmke.de (Postfix) with ESMTP id 9A4B85E0378 for ; Wed, 31 Jan 2018 10:10:53 +0100 (CET) Received: by calimero.vinschen.de (Postfix, from userid 500) id 84A68A80558; Wed, 31 Jan 2018 10:10:53 +0100 (CET) Date: Wed, 31 Jan 2018 09:11:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: RPC clnt_create() adress already in use Message-ID: <20180131091053.GA4223@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <59D90AF8D70E9740907BACDE2BCB520836E01220@RESW102.resdom01.local> <812cb3b6-9d28-971c-45eb-38421d817ca4@maxrnd.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gKMricLos+KVdGMg" Content-Disposition: inline In-Reply-To: <812cb3b6-9d28-971c-45eb-38421d817ca4@maxrnd.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-SW-Source: 2018-01/txt/msg00291.txt.bz2 --gKMricLos+KVdGMg Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1826 On Jan 31 00:15, Mark Geisert wrote: > PAULUS, Raimund, TI-ABN wrote: > > Hi Mark, > >=20 > > in my email (https://sourceware.org/ml/cygwin/2017-12/msg00194.html) i = described 2 approaches. I prefer nr 1. > > Here the part of the source in bindresvport.c: > > [...] > > This causes bind() to search an unused port. I use libtirpc with this f= ix since several weeks and it works for me. I don't know an other way (fixi= ng Cygwin) to success. > > The RPC-client on my pc is started every few minutes and has to connect= to the RPC-server. Without the fix libtirpc is not usable and I have to u= se Cygwin 1.5.18 with the old librpc. > [...] >=20 > Hi Raimund, > Thanks for attaching the complete source for your modified bindresvport.c. > I had been treating your setting of port to 0 as a workaround rather than= as > a solution. My misunderstanding. >=20 > We can't solve the issue that way because when bind() is called with a > zeroed port number, it picks a random port number that's often outside the > range of ports bindresvport() is supposed to return (i.e., a port between > STARTPORT and ENDPORT). >=20 > I thought of something similar to your idea but obeying the bindresvport() > semantics. I add a static short value named 'usecount' to the function's > local variables. Mid-function, I have this code to choose a port number: > if (port =3D=3D 0) { > port =3D ((getpid() + usecount++) % NPORTS) + STARTPORT; > } >=20 > Can you try this with your testcase(s) and make sure it works for you? I'm a bit puzzled here in terms of using your own bindresvport. Cygwin implements bindresvport{_sa} for quite some time, 2006 or earlier. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --gKMricLos+KVdGMg Content-Type: application/pgp-signature; name="signature.asc" Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlpxiB0ACgkQ9TYGna5E T6CGbA//W3UU599RZVcZh6X+LLZR0+QPS1oOPUutnFNB1fNeyTaiK84YFRIaDEBl dEAsmmW/0m4bxvJ4veOGkdxO3CVRwBfROul+0lqFgFRDgvP8ivsvBfDjBQTXFYVn fYvXKpJ89VRTl23MeRpOFJlxSfnCPWuFbUzP6rqQe62XGUcpiS5L71K3wOQqg3Uz Gu69cDRX5ZFnUvgxfCLw25M4ikqUblFihfkl+ly46lIpELJeX8W/X930G0Vzd5JU XXvMCO+7utmMoGjDimoeAmDwzae+FJlXN/FcTVIafAKKdenxRXywMRzm4rqulTAg dP6R2AL9dvg2fQTYTuI9/nzrn9cf/nqTi0U7R//xE+mizyESbDCpgnQO3K0T/GR+ WfJtvYroZa5YibjwQMMefc/TsdyALEOe9nadMxaBCsNoJ09b3qOe+cj1a3YKhQBk jSLcG8qHoOet9+o4THdbOr2wx1wr6VV3vYR+13bkRiLnSN5JldWRbIncNG6QTnEp Tl0JzwGoRx8tZ3T8jx09P2QSlOeNaCDYB+e1v1hbsfj2MRoYZV3s7WAN2ykRZ2bm QaHnknVFhzV+qhyThXZURZKdgwNQVhJROkn1vv4srlLLur+LwcB9DUfe5fxInBrd 9Zey+l6YlKWQWp2rgHEsDkexhZfPkOZHgiFe8lHfr69zS5b3iTk= =gDD5 -----END PGP SIGNATURE----- --gKMricLos+KVdGMg--