comparison cli-runopts.c @ 454:7e43f5e473b9

- Add -K keepalive flag for dropbear and dbclient - Try to reduce the frequency of select() timeouts - Add a max receive window size of 1MB
author Matt Johnston <matt@ucc.asn.au>
date Wed, 08 Aug 2007 15:12:06 +0000
parents 3e6c536bc023
children c1e9c81d1d27 f4addc06745b
comparison
equal deleted inserted replaced
453:29953de278ae 454:7e43f5e473b9
61 "-g Allow remote hosts to connect to forwarded ports\n" 61 "-g Allow remote hosts to connect to forwarded ports\n"
62 #endif 62 #endif
63 #ifdef ENABLE_CLI_REMOTETCPFWD 63 #ifdef ENABLE_CLI_REMOTETCPFWD
64 "-R <listenport:remotehost:remoteport> Remote port forwarding\n" 64 "-R <listenport:remotehost:remoteport> Remote port forwarding\n"
65 #endif 65 #endif
66 "-W <receive_window_buffer> (default %d, larger may be faster)\n" 66 "-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n"
67 "-K <keepalive> (0 is never, default %d)\n"
67 #ifdef DEBUG_TRACE 68 #ifdef DEBUG_TRACE
68 "-v verbose\n" 69 "-v verbose\n"
69 #endif 70 #endif
70 ,DROPBEAR_VERSION, cli_opts.progname, DEFAULT_RECV_WINDOW); 71 ,DROPBEAR_VERSION, cli_opts.progname,
72 DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE);
73
71 } 74 }
72 75
73 void cli_getopts(int argc, char ** argv) { 76 void cli_getopts(int argc, char ** argv) {
74 77
75 unsigned int i, j; 78 unsigned int i, j;
110 opts.ipv4 = 1; 113 opts.ipv4 = 1;
111 opts.ipv6 = 1; 114 opts.ipv6 = 1;
112 */ 115 */
113 opts.recv_window = DEFAULT_RECV_WINDOW; 116 opts.recv_window = DEFAULT_RECV_WINDOW;
114 char* recv_window_arg = NULL; 117 char* recv_window_arg = NULL;
118 char* keepalive_arg = NULL;
115 119
116 /* Iterate all the arguments */ 120 /* Iterate all the arguments */
117 for (i = 1; i < (unsigned int)argc; i++) { 121 for (i = 1; i < (unsigned int)argc; i++) {
118 #ifdef ENABLE_CLI_PUBKEY_AUTH 122 #ifdef ENABLE_CLI_PUBKEY_AUTH
119 if (nextiskey) { 123 if (nextiskey) {
204 case 'u': 208 case 'u':
205 /* backwards compatibility with old urandom option */ 209 /* backwards compatibility with old urandom option */
206 break; 210 break;
207 case 'W': 211 case 'W':
208 next = &recv_window_arg; 212 next = &recv_window_arg;
213 break;
214 case 'K':
215 next = &keepalive_arg;
209 break; 216 break;
210 #ifdef DEBUG_TRACE 217 #ifdef DEBUG_TRACE
211 case 'v': 218 case 'v':
212 debug_trace = 1; 219 debug_trace = 1;
213 break; 220 break;
300 } 307 }
301 308
302 if (recv_window_arg) 309 if (recv_window_arg)
303 { 310 {
304 opts.recv_window = atol(recv_window_arg); 311 opts.recv_window = atol(recv_window_arg);
305 if (opts.recv_window == 0) 312 if (opts.recv_window == 0 || opts.recv_window > MAX_RECV_WINDOW)
306 { 313 {
307 dropbear_exit("Bad recv window '%s'", recv_window_arg); 314 dropbear_exit("Bad recv window '%s'", recv_window_arg);
308 } 315 }
309 } 316 }
317 if (keepalive_arg) {
318 opts.keepalive_secs = strtoul(keepalive_arg, NULL, 10);
319 if (opts.keepalive_secs == 0 && errno == EINVAL)
320 {
321 dropbear_exit("Bad keepalive '%s'", keepalive_arg);
322 }
323 }
324
310 } 325 }
311 326
312 #ifdef ENABLE_CLI_PUBKEY_AUTH 327 #ifdef ENABLE_CLI_PUBKEY_AUTH
313 static void loadidentityfile(const char* filename) { 328 static void loadidentityfile(const char* filename) {
314 329