summaryrefslogtreecommitdiffhomepage
path: root/cli-runopts.c
diff options
context:
space:
mode:
Diffstat (limited to 'cli-runopts.c')
-rw-r--r--cli-runopts.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/cli-runopts.c b/cli-runopts.c
index f38ccd2..68990fa 100644
--- a/cli-runopts.c
+++ b/cli-runopts.c
@@ -63,11 +63,14 @@ static void printhelp() {
#ifdef ENABLE_CLI_REMOTETCPFWD
"-R <listenport:remotehost:remoteport> Remote port forwarding\n"
#endif
- "-W <receive_window_buffer> (default %d, larger may be faster)\n"
+ "-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n"
+ "-K <keepalive> (0 is never, default %d)\n"
#ifdef DEBUG_TRACE
"-v verbose\n"
#endif
- ,DROPBEAR_VERSION, cli_opts.progname, DEFAULT_RECV_WINDOW);
+ ,DROPBEAR_VERSION, cli_opts.progname,
+ DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE);
+
}
void cli_getopts(int argc, char ** argv) {
@@ -112,6 +115,7 @@ void cli_getopts(int argc, char ** argv) {
*/
opts.recv_window = DEFAULT_RECV_WINDOW;
char* recv_window_arg = NULL;
+ char* keepalive_arg = NULL;
/* Iterate all the arguments */
for (i = 1; i < (unsigned int)argc; i++) {
@@ -207,6 +211,9 @@ void cli_getopts(int argc, char ** argv) {
case 'W':
next = &recv_window_arg;
break;
+ case 'K':
+ next = &keepalive_arg;
+ break;
#ifdef DEBUG_TRACE
case 'v':
debug_trace = 1;
@@ -302,11 +309,19 @@ void cli_getopts(int argc, char ** argv) {
if (recv_window_arg)
{
opts.recv_window = atol(recv_window_arg);
- if (opts.recv_window == 0)
+ if (opts.recv_window == 0 || opts.recv_window > MAX_RECV_WINDOW)
{
dropbear_exit("Bad recv window '%s'", recv_window_arg);
}
}
+ if (keepalive_arg) {
+ opts.keepalive_secs = strtoul(keepalive_arg, NULL, 10);
+ if (opts.keepalive_secs == 0 && errno == EINVAL)
+ {
+ dropbear_exit("Bad keepalive '%s'", keepalive_arg);
+ }
+ }
+
}
#ifdef ENABLE_CLI_PUBKEY_AUTH