diff options
author | Matt Johnston <matt@ucc.asn.au> | 2008-11-02 12:25:08 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2008-11-02 12:25:08 +0000 |
commit | 5cd6995fb5ab34c3ff2e77f94be1be4135248db3 (patch) | |
tree | c93488a101d8b57a5c29335b95fb5ec071644e07 /cli-tcpfwd.c | |
parent | ed79abed76fd91231929100ca3421913827ba83f (diff) |
Report errors if a remote request fails
--HG--
extra : convert_revision : ed1584aacf189b8f8ddee813b98342fa8bb38022
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; |