[PATCH] Fix control persist and stdio forward interaction

Ricky Zhou ricky at rzhou.org
Thu Oct 13 20:18:43 EST 2011


As reported earlier at

https://lists.mindrot.org/pipermail/openssh-unix-dev/2011-March/029441.html

there is some strange interaction between ControlPersist and ssh -W that
breaks things if you're using both.  Specifically, ssh -W host:port with
ControlPersist enabled opens up two connections to host:port and sends
data from both back.

I think this is happening because channel_connect_stdio_fwd is being
called twice, once in client_setup_stdio_fwd, which is called from
ssh_init_forwarding, and once in process_mux_stdio_fwd, which is
called once the client process starts talking to the master process.

It looks like the way ControlPersist is implemented, the process forks,
with the child becoming the master process and the child making its
connection through that.   Thus, it seems like a reasonable fix to not
call client_setup_stdio_fwd if need_controlpersist_detach is set, and
just allow it to happen later.

Does the attached patch look OK?

Thanks,
Ricky
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20111013/1801e07e/attachment.bin>


More information about the openssh-unix-dev mailing list