mirror of
https://github.com/clearml/dropbear
synced 2025-06-26 18:17:32 +00:00
- A nice cleaner structure for tcp (acceptor) forwarding.
- still a checkpoint-ish commit - sorted out listening on localhost only --HG-- extra : convert_revision : c030ac0a3950dba81f2324e2ba9d4b77fc8f8149
This commit is contained in:
12
cli-tcpfwd.c
12
cli-tcpfwd.c
@@ -12,22 +12,26 @@ static const struct ChanType cli_chan_tcplocal = {
|
||||
NULL
|
||||
};
|
||||
|
||||
void setup_localtcp() {
|
||||
|
||||
qv
|
||||
|
||||
}
|
||||
|
||||
static int cli_localtcp(char* port) {
|
||||
static int cli_localtcp(unsigned int listenport, const char* remoteaddr,
|
||||
unsigned int remoteport) {
|
||||
|
||||
struct TCPListener* tcpinfo = NULL;
|
||||
|
||||
tcpinfo = (struct TCPListener*)m_malloc(sizeof(struct TCPListener*));
|
||||
tcpinfo->addr = NULL;
|
||||
tcpinfo->port = port;
|
||||
tcpinfo->sendaddr = remoteaddr;
|
||||
tcpinfo->sendport = remoteport;
|
||||
tcpinfo->listenport = listenport;
|
||||
tcpinfo->chantype = &cli_chan_tcplocal;
|
||||
|
||||
ret = listen_tcpfwd(tcpinfo);
|
||||
|
||||
if (ret == DROPBEAR_FAILURE) {
|
||||
DROPBEAR_LOG(LOG_WARNING, "Failed to listen on port %s", port);
|
||||
m_free(tcpinfo);
|
||||
}
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user