bugzilla-daemon at bugzilla.mindrot.org
2011-Oct-16  17:33 UTC
[Bug 1943] New: [PATCH] ssh -W opens two connections when ControlPersist is enabled.
https://bugzilla.mindrot.org/show_bug.cgi?id=1943
             Bug #: 1943
           Summary: [PATCH] ssh -W opens two connections when
                    ControlPersist is enabled.
    Classification: Unclassified
           Product: Portable OpenSSH
           Version: 5.9p1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ssh
        AssignedTo: unassigned-bugs at mindrot.org
        ReportedBy: ricky at rzhou.org
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.   This patch makes client_setup_stdio_fwd not
get called the first time if need_controlpersist_detach is set, and
lets
it happen through the master process.
-- 
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2011-Oct-20  23:45 UTC
[Bug 1943] [PATCH] ssh -W opens two connections when ControlPersist is enabled.
https://bugzilla.mindrot.org/show_bug.cgi?id=1943 --- Comment #1 from Damien Miller <djm at mindrot.org> 2011-10-21 10:45:20 EST --- Created attachment 2100 --> https://bugzilla.mindrot.org/attachment.cgi?id=2100 bz1943.diff fix dupe stdio forward with ControlPersist -- Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2011-Oct-20  23:46 UTC
[Bug 1943] [PATCH] ssh -W opens two connections when ControlPersist is enabled.
https://bugzilla.mindrot.org/show_bug.cgi?id=1943
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2100|                            |ok?(dtucker at zip.com.au)
              Flags|                            |
-- 
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2011-Oct-20  23:46 UTC
[Bug 1943] [PATCH] ssh -W opens two connections when ControlPersist is enabled.
https://bugzilla.mindrot.org/show_bug.cgi?id=1943
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |djm at mindrot.org
             Blocks|                            |1930
-- 
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2012-Jan-07  08:07 UTC
[Bug 1943] [PATCH] ssh -W opens two connections when ControlPersist is enabled.
https://bugzilla.mindrot.org/show_bug.cgi?id=1943
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
simon-bz at exyr.org changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simon-bz at exyr.org
--- Comment #2 from Damien Miller <djm at mindrot.org> 2011-11-04 10:14:01
EST ---
patch applied - this will be in openssh-6.0. Thanks!
--- Comment #3 from simon-bz at exyr.org 2012-01-07 19:07:50 EST ---
A workaround for versions before 6.0: instead of
    ssh -W %h:%p gateway
Use:
    sh -c "ssh gateway true < /dev/null && ssh -W %h:%p
gateway"
The first ssh call does not use -W so it is not affected by this bug.
It makes sure that the master process is running. The second call does
not need to fork a master so it is not affected either.
-- 
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
Maybe Matching Threads
- [PATCH] Fix control persist and stdio forward interaction
- ssh -f and -O ControlPersist=yes, ControlMaster=yes leaves stderr open
- [Bug 1943] [PATCH] ssh -W opens two connections when ControlPersist is enabled.
- [Bug 2394] New: Provide a global configuration option to disable ControlPersist
- Problemes with ControlPersist