X-Spam-Check-By: sourceware.org Date: Wed, 1 Feb 2006 10:15:18 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: SSH Local Port Forwarding Message-ID: <20060201091518.GC15572@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <242f7d730601311525q537172d2l23e572154b475cd9 AT mail DOT gmail DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <242f7d730601311525q537172d2l23e572154b475cd9@mail.gmail.com> User-Agent: Mutt/1.4.2i Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: 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 On Jan 31 15:25, Jon Dixon wrote: > Hi Corinna, > > I have tested the cygwin-inst-20060130.tar.bz2 snapshot. > Unfortunately, this snapshot runs the same way as release 1.5.19-4. No, it doesn't, definitely. 1.5.19-4 has not set the SO_EXCLUSIVEADDRUSE option, and I could easily reuse ports for listening before. I didn't just add SO_EXCLUSIVEADDRUSE without testing. Keep in mind that the ssh testcase is sort of flawed by the fact, that ssh uses the SO_REUSEADDR option on locally forwarded ports. There's a combination which already disallowed port reuse without implementing SO_EXCLUSIVEADDRUSE. > Cygwin does however behave differently on Windows 2000 Server than on > Windows 2003 Server. > > The following describes the behavior of Cygwin (release or snapshot) > running on Windows 2000 Server sp 4. > > The SSH local port forwarding is activated with the command line statement: > ssh -L2001:server.com:23 server.com. > > If another program is executed that also listens on port 2001, the > program immediately throws the bind error exception: Address already > in use. > > Cygwin (release or snapshot) running on Windows 2003 Server sp 1 > however does not throw a bind exception. That's not what I can reproduce easily. I have a small test application called "fsu", which does nothing but socket/bind/listen/accept on port 9998. The two test scenarios are starting ssh first, then fsu and vice versa. Below are the output logs of both scenarios which happen IDENTICALLY on 2K SP4, XP SP2 and 2K3 SP1, with a recent snapshot. I just tested it on all three OSes again: Window 1: $ fsu server socket at 3 Listening at host cathi, port 9998 waiting for the messages Window 2: $ ssh -L9998:calimero:1234 calimero bind: Operation not permitted channel_setup_fwd_listener: cannot listen to port: 9998 Could not request local forwarding. Last login: Sun Jan 29 12:18:46 2006 from cathi calimero> Now starting ssh first, then fsu: Window 1: $ ssh -L9998:calimero:1234 calimero Last login: Wed Feb 1 09:50:23 2006 from cathi calimero> Window 2: $ fsu server socket at 3 Error: server binding error $ If you think there's still something not ok, I need a short, concise, minimal testcase, preferredly in plain C, which builds OOTB and allows reproducing the unwanted port reuse. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/