[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Global Request for tcpip reverse forward


Hello!

This is my first time writing in the mailing list, I’m really new to libssh.

I’m trying to get a server and client implementation for reverse port forwarding. 

My understanding it that client requests the server for reverse port forwarding in a given port, server handles the petition and is responsible for managing the socket and redirecting data from socket to ssh channel. Client is responsible for reading ssh channel and sending data to the local server.

I have successfully managed to get authentication between client and server work correctly.

The part I’m probably missing something is on how to handle the global request from client and how to pull for data in the client.

Basic pseudo code that I’m doing.

- Client send global request to server using `ssh_channel_listen_forward`. 
- Server handles the request using callback global_request_function and responds with ssh_message_global_request_reply_success
- Client calls ssh_channel_accept_forward to get a new channel

My problem is that `ssh_channel_accept_forward` never returns. I’m not sure If I’m missing something on the server side to initiate the channel. I know that I then need to redirect data between socket and channel but first I think I need to get a valid channel for forwarding right ?

My complete code can be found here: https://gist.github.com/bilby91/22d5cc5db0e6118f06d6d35051c32cc6

Thanks before hand!

Martín

Follow-Ups:
RE: Global Request for tcpip reverse forwardMeng Hourk Tan <mtan@xxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org