[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
=?gb18030?b?u9i4tKO6ILvYuLSjukhPVyB0byB1c2Ugc3NoX2No?==?gb18030?b?YW5uZWxfb3Blbl9yZXZlcnNlX2ZvcndhcmQgZnVu?==?gb18030?b?Y3Rpb24gdG8gaW1wbGVtZW50IGEgcmV2ZXJzZSB0?==?gb18030?b?dW5uZWw/?=
[Thread Prev] | [Thread Next]
- Subject: =?gb18030?b?u9i4tKO6ILvYuLSjukhPVyB0byB1c2Ugc3NoX2No?==?gb18030?b?YW5uZWxfb3Blbl9yZXZlcnNlX2ZvcndhcmQgZnVu?==?gb18030?b?Y3Rpb24gdG8gaW1wbGVtZW50IGEgcmV2ZXJzZSB0?==?gb18030?b?dW5uZWw/?=
- From: "=?gb18030?b?wfXUqtXc?=" <945695107@xxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 9 Apr 2020 18:11:46 +0800
- To: "=?gb18030?b?bGlic3No?=" <libssh@xxxxxxxxxx>
Ok... Well I have got some progress. The func ssh_channel_listen_forward is actually working in block mode, which means it will hold until get the server reply. I think this makes sense, see maybe server doesn't open this option and directly reject this request. This also makes server have completely control when should open the reverse channel, I have test it and seems it works. Now my problem is how can I code a message_callback in client side? I have tried set_message_callback, but it seems not have any affect. The func ssh_channel_accept_forward implement as look for message_list in a time range, out of range will cause it directly return NULL. I want is before server decide to open a reverse channel, the client do nothing except in a mainloop, once server decide to open it, ok, the client can through message_callback to determine whether it's SSH_MSG_CHANNEL_FORWARD type forwarded-tcpip, and accept and reject it. Thanks, Yuanzhe ------------------ 原始邮件 ------------------ 发件人: "Andreas Schneider"<asn@xxxxxxxxxxxxxx>; 发送时间: 2020年4月9日(星期四) 下午2:52 收件人: "libssh"<libssh@xxxxxxxxxx>; 抄送: "刘元哲"<945695107@xxxxxx>; 主题: Re: 回复:HOW to use ssh_channel_open_reverse_forward function to implement a reverse tunnel? On Wednesday, 8 April 2020 17:21:44 CEST 刘元哲 wrote: > Re-Update: > After compared the different result > between&nbsp;ssh_message_global_request_reply_success > before&nbsp;ssh_channel_open_reverse_forward or after it I > found&nbsp;ssh_channel_listen_forward want a reply, so if I reply it > immediately, the ssh client then said "ssh_global_request: Global request > tcpip-forward success"and&nbsp; can't > receive&nbsp;ssh_channel_open_reverse_forward request. Otherwise if I > choose to reply it after ssh_channel_open_reverse_forward, > the&nbsp;&nbsp;ssh_channel_listen_forward will hang there, continue wait > for the&nbsp; reply. I've never used that code, we don't have example code nor a test for it. So as always I would argue: Untested code is broken code. I think we need to implement a test to actually fix the code. However I don't have time for this. Contributions in this area are very welcome. See the server testing code Anderson implemented for a start. Best regards, Andreas -- Andreas Schneider asn@xxxxxxxxxxxxxx GPG-ID: 8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
HOW to use ssh_channel_open_reverse_forward function to implement a reverse tunnel? | "=?gb18030?b?wfXUqtXc?=" <945695107@xxxxxx> |
=?gb18030?b?u9i4tKO6SE9XIHRvIHVzZSBzc2hfY2hhbm5lbF9v?==?gb18030?b?cGVuX3JldmVyc2VfZm9yd2FyZCBmdW5jdGlvbiB0?==?gb18030?b?byBpbXBsZW1lbnQgYSByZXZlcnNlIHR1bm5lbD8=?= | "=?gb18030?b?wfXUqtXc?=" <945695107@xxxxxx> |
=?gb18030?b?u9i4tKO6SE9XIHRvIHVzZSBzc2hfY2hhbm5lbF9v?==?gb18030?b?cGVuX3JldmVyc2VfZm9yd2FyZCBmdW5jdGlvbiB0?==?gb18030?b?byBpbXBsZW1lbnQgYSByZXZlcnNlIHR1bm5lbD8=?= | "=?gb18030?b?wfXUqtXc?=" <945695107@xxxxxx> |
Re: 回复:HOW to use ssh_channel_open_reverse_forward function to implement a reverse tunnel? | Andreas Schneider <asn@xxxxxxxxxxxxxx> |