delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/03/29/07:18:27

X-Spam-Check-By: sourceware.org
Date: Wed, 29 Mar 2006 14:18:12 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Sshd: problem with X11 passthru
Message-ID: <20060329121812.GW20907@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <2fc802c00603281420u86803b9q336bb78f22863e27 AT mail DOT gmail DOT com> <2fc802c00603281424q7764db49p3d2f595807042584 AT mail DOT gmail DOT com>
Mime-Version: 1.0
In-Reply-To: <2fc802c00603281424q7764db49p3d2f595807042584@mail.gmail.com>
User-Agent: Mutt/1.4.2i
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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 Mar 28 23:24, David Picton wrote:
> >    * From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
> >    * To: cygwin at cygwin dot com
> >    * Date: Tue, 28 Mar 2006 12:29:40 +0200
> >
> >On Mar 28 10:17, David Picton wrote:
> > >From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
> > >On Mar 27 18:55, David Picton wrote:
> > >> I have encountered a problem with the sshd server when the client
> > >> specifies X11 passthru i.e. ssh -Y or ssh -X.
> > >>
> 
> [snip original bug report]
> 
> >> Apologies for not making it clear that I was talking about the Cygwin
> >> port of sshd.
> >> The bug seems to be specific to the Cygwin version and I've not
> seen it on other
> >> systems.
> >
> >Well, the problem is this.  I just tried it and I can't reproduce it.
> >Each session gets another display number, starting at 10, as expected.
> >Maybe this is somehow due to a sshd_config setting which uncovers a
> >sshd problem?  I don't see how this should be related to Cygwin.  I still
> >think this should be a question for a ssh mailing list.
> >
> >Corinna
> 
> For the record, I'd like to say how I resolved the problem - if I can
> be permitted just one more post on the subject ...
> 
> I reproduced the bug when I tried installing the current version of
> sshd on a second XP machine - DISPLAY=:10.0 every time. (The
> sshd_config was exactly as created by ssh-host-config - except for one
> change to permit X11 passthru.)
> 
> Then I tried reverting to an older version of sshd.exe (dated
> September 2005) and hey presto - the bug was magicked away.  So I'm
> using that version now.

Urgh.  I found the problem.  I tested with the latest snapshot, not
with 1.5.19, so this didn't happen to me.  As soon as I switched to
1.5.19 I could reproduce.  Sorry about that.

The low level cause of this problem is a bug in SO_REUSEADDR handling in
WinSock.  Per standards, we must not be able to reuse a complete
duplicate of a local TCP address (same IP, same port), even if
SO_REUSEADDR has been set.  That's unfortunately possible in WinSock.

The higher level cause is that OpenSSH 4.3, in contrast to 4.2, uses
SO_REUSEADDR on the X11 ports to (quote from the ChangeLog):

  "prevent[...] bind() failure when a previous connection's listeners
   are in TIME_WAIT."

The reason that I don't see this problem in the current developer
snapshots is the fact that I added code to post-1.5.19 Cygwin to
circumvent the above mentioned SO_REUSEADDR bug in WinSock.  So, with a
developer snapshot, Cygwin goes through the list of current connections,
finds that the port is in use and refrains from calling bind() on that
port. The result is that sshd tries the next port and the behaviour
is again as it is correct and as it was with OpenSSH 4.2.

I will upload a new version of OpenSSH 4.3p2 which does not set
SO_REUSEADDR on the the X11 forwarding listener sockets.  This will
solve the problem for 1.5.19.


Thanks for the report,
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/

- Raw text -


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