diff 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
line wrap: on
line diff
--- a/cli-runopts.c	Mon Sep 22 14:13:44 2008 +0000
+++ b/cli-runopts.c	Mon Sep 22 15:28:52 2008 +0000
@@ -70,6 +70,7 @@
 #endif
 					"-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n"
 					"-K <keepalive>  (0 is never, default %d)\n"
+					"-I <idle_timeout>  (0 is never, default %d)\n"
 #ifdef ENABLE_CLI_NETCAT
 					"-B <endhost:endport> Netcat-alike bouncing\n"
 #endif				
@@ -80,7 +81,7 @@
 					"-v    verbose\n"
 #endif
 					,DROPBEAR_VERSION, cli_opts.progname,
-					DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE);
+					DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE, DEFAULT_IDLE_TIMEOUT);
 					
 }
 
@@ -105,6 +106,7 @@
 
 	char* recv_window_arg = NULL;
 	char* keepalive_arg = NULL;
+	char* idle_timeout_arg = NULL;
 
 	/* see printhelp() for options */
 	cli_opts.progname = argv[0];
@@ -252,6 +254,9 @@
 				case 'K':
 					next = &keepalive_arg;
 					break;
+				case 'I':
+					next = &idle_timeout_arg;
+					break;
 #ifdef DEBUG_TRACE
 				case 'v':
 					debug_trace = 1;
@@ -359,6 +364,11 @@
 			dropbear_exit("Bad keepalive '%s'", keepalive_arg);
 		}
 	}
+	if (idle_timeout_arg) {
+		if (m_str_to_uint(idle_timeout_arg, &opts.idle_timeout_secs) == DROPBEAR_FAILURE) {
+			dropbear_exit("Bad idle_timeout '%s'", idle_timeout_arg);
+		}
+	}
 
 #ifdef ENABLE_CLI_NETCAT
 	if (cli_opts.cmd && cli_opts.netcat_host) {