Mercurial > dropbear
comparison svr-tcpfwd.c @ 1051:359fba4b1a49
merge tcp fastopen
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 28 Feb 2015 23:24:30 +0800 |
parents | 0da8ba489c23 |
children | c45d65392c1a |
comparison
equal
deleted
inserted
replaced
1045:31727a8abd4b | 1051:359fba4b1a49 |
---|---|
31 #include "buffer.h" | 31 #include "buffer.h" |
32 #include "packet.h" | 32 #include "packet.h" |
33 #include "listener.h" | 33 #include "listener.h" |
34 #include "runopts.h" | 34 #include "runopts.h" |
35 #include "auth.h" | 35 #include "auth.h" |
36 #include "netio.h" | |
36 | 37 |
37 #ifndef ENABLE_SVR_REMOTETCPFWD | 38 #ifndef ENABLE_SVR_REMOTETCPFWD |
38 | 39 |
39 /* This is better than SSH_MSG_UNIMPLEMENTED */ | 40 /* This is better than SSH_MSG_UNIMPLEMENTED */ |
40 void recv_msg_global_request_remotetcp() { | 41 void recv_msg_global_request_remotetcp() { |
234 unsigned char* desthost = NULL; | 235 unsigned char* desthost = NULL; |
235 unsigned int destport; | 236 unsigned int destport; |
236 unsigned char* orighost = NULL; | 237 unsigned char* orighost = NULL; |
237 unsigned int origport; | 238 unsigned int origport; |
238 char portstring[NI_MAXSERV]; | 239 char portstring[NI_MAXSERV]; |
239 int sock; | |
240 int len; | 240 int len; |
241 int err = SSH_OPEN_ADMINISTRATIVELY_PROHIBITED; | 241 int err = SSH_OPEN_ADMINISTRATIVELY_PROHIBITED; |
242 | 242 |
243 TRACE(("newtcpdirect channel %d", channel->index)) | 243 TRACE(("newtcpdirect channel %d", channel->index)) |
244 | 244 |
268 TRACE(("leave newtcpdirect: port > 65535")) | 268 TRACE(("leave newtcpdirect: port > 65535")) |
269 goto out; | 269 goto out; |
270 } | 270 } |
271 | 271 |
272 snprintf(portstring, sizeof(portstring), "%d", destport); | 272 snprintf(portstring, sizeof(portstring), "%d", destport); |
273 sock = connect_remote(desthost, portstring, NULL); | 273 channel->conn_pending = connect_remote(desthost, portstring, channel_connect_done, channel); |
274 if (sock < 0) { | |
275 err = SSH_OPEN_CONNECT_FAILED; | |
276 TRACE(("leave newtcpdirect: sock failed")) | |
277 goto out; | |
278 } | |
279 | |
280 ses.maxfd = MAX(ses.maxfd, sock); | |
281 | |
282 /* We don't set readfd, that will get set after the connection's | |
283 * progress succeeds */ | |
284 channel->writefd = sock; | |
285 channel->initconn = 1; | |
286 | 274 |
287 channel->prio = DROPBEAR_CHANNEL_PRIO_UNKNOWABLE; | 275 channel->prio = DROPBEAR_CHANNEL_PRIO_UNKNOWABLE; |
288 | 276 |
289 err = SSH_OPEN_IN_PROGRESS; | 277 err = SSH_OPEN_IN_PROGRESS; |
290 | 278 |