Subject: Re: help in understanding _direct_tcpip_ex()

Re: help in understanding _direct_tcpip_ex()

From: Peter Stuge <>
Date: Sun, 4 Jul 2010 11:55:06 +0200

Hi Dor,

Dor Zaidenberg wrote:
> I am no more registered on digest so things should work much better
> from now on...

Okey. No problem, I don't always have a chance to reply immediately

> >"No, since then you would require a tunnel in the other direction, a
> >so-called "forwarded-tcpip" tunnel, going from the remote server to
> >your local machine.
> >That is a different type of channel from "direct-tcpip" and it is
> >currently not implemented in libssh2. "
> Ok.... , assuming I have complete control on the remote server I wish
> to connect to, is there any action I can perform on that remote
> server, on the system level, that will make this tunnel working?

No, the lack of support would only be in libssh2. All servers already
support forwarded-tcpip, but I thought libssh2 didn't..

> >"Part of the reason may be that this type of tunnel (forwarded-tcpip)
> >requires libssh2 to dynamically create channels, based on nothing but
> >packets from the remote host. This does not fit so well with how
> >libssh2 was designed.
> >
> >That said, I think it would be great if libssh2 also supported
> >forwarded-tcpip channels, so please look into adding it! :)"
> I am considering this, but honestly I cant afford to invest a long
> period of work on this matter
> Can you give provide me with a focus on the pieces of code need to be
> changed and an exlanation of what I need to do or a link to a good
> place that will explain?

..ehh - I just discovered that I'm completely wrong!

libssh2 *does* support also forwarded-tcpip tunnels, through the
libssh2_channel_forward_* API. I'm very sorry for the confusion!

Please check out the man pages for how to use it. It's similar to
regular sockets. First call _listen(), then _accept(). Wow, I'm
sorry about this confusion.

If you want to write an example that would be great. If not, I might
take a stab at it, but please don't wait for me to do it, it may take
a while.

Received on 2010-07-04