ControlPersist and multiple X11 forwarding.
David Woodhouse
dwmw2 at infradead.org
Mon Sep 5 19:15:17 EST 2005
On Sun, 2005-09-04 at 17:46 +0100, David Woodhouse wrote:
> And why does the X11 connection stall after authentication, until
> after some other traffic occurs between client and server?
To answer my own question... it's because we allocated a new file
descriptor and increased channel_fd_max, but we did so only _after_
channel_prepare_select() had already set *maxfdp and made sure that the
fd_sets were large enough to cope. So we don't get to select on the new
one until the _next_ time round the loop.
Not only that, but when we do FD_SET the new file descriptor in an
existing fd_set, we could be scribbling over random memory because the
fd_set isn't actually large enough.
A quick but dirty workaround is just to have channel_prepare_select()
allow for one or two more file descriptors than we actually need. If we
can get _many_ simultaneous X11 authentication packets, though, all on
different connections, then that won't be sufficient. Better
suggestions...?
--- openssh-4.2p1/channels.c~ 2005-09-05 09:05:21.000000000 +0100
+++ openssh-4.2p1/channels.c 2005-09-05 09:05:56.000000000 +0100
@@ -1779,7 +1779,8 @@ channel_prepare_select(fd_set **readsetp
{
u_int n, sz;
- n = MAX(*maxfdp, channel_max_fd);
+ /* Allow for two more fds to be allocated */
+ n = MAX(*maxfdp, channel_max_fd + 2);
sz = howmany(n+1, NFDBITS) * sizeof(fd_mask);
/* perhaps check sz < nalloc/2 and shrink? */
--
dwmw2
More information about the openssh-unix-dev
mailing list