Uploaded image for project: 'MINA SSHD'
  1. MINA SSHD
  2. SSHD-1293

ExplicitPortForwardingTracker does not unbind auto-allocated one

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.8.0
    • 2.9.2
    • None

    Description

      I have noticed that the de-allocation (unbind of a forwarding) initiated by org.apache.sshd.client.session.forward.ExplicitPortForwardingTracker in the close() method will not no close the actual forwarding. Said that, this leaves the connection and a file handler open.

      The actual main reason is that it uses manager.stopLocalPortForwarding(this.getLocalAddress()); which means it stops the tunnel identified the "local address" which is the same as provided by the user. If the user is using a local address with port 0 (which seems legit since the docs state this explicitly), the local address will be still something like 0.0.0.0:0 or maybe 127.0.0.1:0, but only the "bound address" contains the actual dynamic auto-allocated port.

      If the user uses an explicit port, this would work.

      As a workaround, I have added after tracker.close() an explicit session.stopLocalPortForwarding(tracker.getBoundAddress()). I don't know if this would your final solution or this would be an issue in DefaultForwarder#stopLocalPortForwarding.

       

      I'm using 2.8 right now; as far as I can see there are no changes in 2.9 regarding this.

      Attachments

        Activity

          People

            Unassigned Unassigned
            knalli Jan Philipp
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 20m
                1h 20m