Mercurial > dropbear
comparison cli-runopts.c @ 493:6cd2152aae0b idle-timeout
Idle-timeout patch from Farrell Aultman, need to figure whether to only
account DATA packets and whether server->client data makes sense too.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 22 Sep 2008 15:28:52 +0000 |
parents | b956d6151600 |
children |
comparison
equal
deleted
inserted
replaced
492:b956d6151600 | 493:6cd2152aae0b |
---|---|
68 #ifdef ENABLE_CLI_REMOTETCPFWD | 68 #ifdef ENABLE_CLI_REMOTETCPFWD |
69 "-R <listenport:remotehost:remoteport> Remote port forwarding\n" | 69 "-R <listenport:remotehost:remoteport> Remote port forwarding\n" |
70 #endif | 70 #endif |
71 "-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n" | 71 "-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n" |
72 "-K <keepalive> (0 is never, default %d)\n" | 72 "-K <keepalive> (0 is never, default %d)\n" |
73 "-I <idle_timeout> (0 is never, default %d)\n" | |
73 #ifdef ENABLE_CLI_NETCAT | 74 #ifdef ENABLE_CLI_NETCAT |
74 "-B <endhost:endport> Netcat-alike bouncing\n" | 75 "-B <endhost:endport> Netcat-alike bouncing\n" |
75 #endif | 76 #endif |
76 #ifdef ENABLE_CLI_PROXYCMD | 77 #ifdef ENABLE_CLI_PROXYCMD |
77 "-J <proxy_program> Use program rather than tcp connection\n" | 78 "-J <proxy_program> Use program rather than tcp connection\n" |
78 #endif | 79 #endif |
79 #ifdef DEBUG_TRACE | 80 #ifdef DEBUG_TRACE |
80 "-v verbose\n" | 81 "-v verbose\n" |
81 #endif | 82 #endif |
82 ,DROPBEAR_VERSION, cli_opts.progname, | 83 ,DROPBEAR_VERSION, cli_opts.progname, |
83 DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE); | 84 DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE, DEFAULT_IDLE_TIMEOUT); |
84 | 85 |
85 } | 86 } |
86 | 87 |
87 void cli_getopts(int argc, char ** argv) { | 88 void cli_getopts(int argc, char ** argv) { |
88 | 89 |
103 #endif | 104 #endif |
104 char* dummy = NULL; /* Not used for anything real */ | 105 char* dummy = NULL; /* Not used for anything real */ |
105 | 106 |
106 char* recv_window_arg = NULL; | 107 char* recv_window_arg = NULL; |
107 char* keepalive_arg = NULL; | 108 char* keepalive_arg = NULL; |
109 char* idle_timeout_arg = NULL; | |
108 | 110 |
109 /* see printhelp() for options */ | 111 /* see printhelp() for options */ |
110 cli_opts.progname = argv[0]; | 112 cli_opts.progname = argv[0]; |
111 cli_opts.remotehost = NULL; | 113 cli_opts.remotehost = NULL; |
112 cli_opts.remoteport = NULL; | 114 cli_opts.remoteport = NULL; |
250 next = &recv_window_arg; | 252 next = &recv_window_arg; |
251 break; | 253 break; |
252 case 'K': | 254 case 'K': |
253 next = &keepalive_arg; | 255 next = &keepalive_arg; |
254 break; | 256 break; |
257 case 'I': | |
258 next = &idle_timeout_arg; | |
259 break; | |
255 #ifdef DEBUG_TRACE | 260 #ifdef DEBUG_TRACE |
256 case 'v': | 261 case 'v': |
257 debug_trace = 1; | 262 debug_trace = 1; |
258 break; | 263 break; |
259 #endif | 264 #endif |
355 } | 360 } |
356 } | 361 } |
357 if (keepalive_arg) { | 362 if (keepalive_arg) { |
358 if (m_str_to_uint(keepalive_arg, &opts.keepalive_secs) == DROPBEAR_FAILURE) { | 363 if (m_str_to_uint(keepalive_arg, &opts.keepalive_secs) == DROPBEAR_FAILURE) { |
359 dropbear_exit("Bad keepalive '%s'", keepalive_arg); | 364 dropbear_exit("Bad keepalive '%s'", keepalive_arg); |
365 } | |
366 } | |
367 if (idle_timeout_arg) { | |
368 if (m_str_to_uint(idle_timeout_arg, &opts.idle_timeout_secs) == DROPBEAR_FAILURE) { | |
369 dropbear_exit("Bad idle_timeout '%s'", idle_timeout_arg); | |
360 } | 370 } |
361 } | 371 } |
362 | 372 |
363 #ifdef ENABLE_CLI_NETCAT | 373 #ifdef ENABLE_CLI_NETCAT |
364 if (cli_opts.cmd && cli_opts.netcat_host) { | 374 if (cli_opts.cmd && cli_opts.netcat_host) { |