diff options
Diffstat (limited to 'cli-tcpfwd.c')
-rw-r--r-- | cli-tcpfwd.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/cli-tcpfwd.c b/cli-tcpfwd.c index c3bfd4d..0e60090 100644 --- a/cli-tcpfwd.c +++ b/cli-tcpfwd.c @@ -128,7 +128,7 @@ static void send_msg_global_request_remotetcp(int port) { CHECKCLEARTOWRITE(); buf_putbyte(ses.writepayload, SSH_MSG_GLOBAL_REQUEST); buf_putstring(ses.writepayload, "tcpip-forward", 13); - buf_putbyte(ses.writepayload, 0); + buf_putbyte(ses.writepayload, 1); /* want_reply */ if (opts.listen_fwd_all) { listenspec = ""; } else { @@ -143,6 +143,42 @@ static void send_msg_global_request_remotetcp(int port) { TRACE(("leave send_msg_global_request_remotetcp")) } +/* The only global success/failure messages are for remotetcp. + * Since there isn't any identifier in these messages, we have to rely on them + * being in the same order as we sent the requests. This is the ordering + * of the cli_opts.remotefwds list */ +void cli_recv_msg_request_success() { + + /* Nothing in the packet. We just mark off that we have received the reply, + * so that we can report failure for later ones. */ + struct TCPFwdList * iter = NULL; + + iter = cli_opts.remotefwds; + while (iter != NULL) { + if (!iter->have_reply) + { + iter->have_reply = 1; + return; + } + iter = iter->next; + } +} + +void cli_recv_msg_request_failure() { + struct TCPFwdList * iter = NULL; + + iter = cli_opts.remotefwds; + while (iter != NULL) { + if (!iter->have_reply) + { + iter->have_reply = 1; + dropbear_log(LOG_WARNING, "Remote TCP forward request failed (port %d -> %s:%d)", iter->listenport, iter->connectaddr, iter->connectport); + return; + } + iter = iter->next; + } +} + void setup_remotetcp() { struct TCPFwdList * iter = NULL; |