summaryrefslogtreecommitdiffhomepage
path: root/svr-runopts.c
diff options
context:
space:
mode:
Diffstat (limited to 'svr-runopts.c')
-rw-r--r--svr-runopts.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/svr-runopts.c b/svr-runopts.c
index f78461b..83c75c3 100644
--- a/svr-runopts.c
+++ b/svr-runopts.c
@@ -80,7 +80,8 @@ static void printhelp(const char * progname) {
#ifdef INETD_MODE
"-i Start for inetd\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
@@ -91,7 +92,8 @@ static void printhelp(const char * progname) {
#ifdef DROPBEAR_RSA
RSA_PRIV_FILENAME,
#endif
- DROPBEAR_MAX_PORTS, DROPBEAR_DEFPORT, DROPBEAR_PIDFILE, DEFAULT_RECV_WINDOW);
+ DROPBEAR_MAX_PORTS, DROPBEAR_DEFPORT, DROPBEAR_PIDFILE,
+ DEFAULT_RECV_WINDOW, DEFAULT_KEEPALIVE);
}
void svr_getopts(int argc, char ** argv) {
@@ -99,6 +101,8 @@ void svr_getopts(int argc, char ** argv) {
unsigned int i;
char ** next = 0;
int nextisport = 0;
+ char* recv_window_arg = NULL;
+ char* keepalive_arg = NULL;
/* see printhelp() for options */
svr_opts.rsakeyfile = NULL;
@@ -130,7 +134,8 @@ void svr_getopts(int argc, char ** argv) {
svr_opts.usingsyslog = 1;
#endif
opts.recv_window = DEFAULT_RECV_WINDOW;
- char* recv_window_arg = NULL;
+ opts.keepalive_secs = DEFAULT_KEEPALIVE;
+
#ifdef ENABLE_SVR_REMOTETCPFWD
opts.listen_fwd_all = 0;
#endif
@@ -210,6 +215,9 @@ void svr_getopts(int argc, char ** argv) {
case 'W':
next = &recv_window_arg;
break;
+ case 'K':
+ next = &keepalive_arg;
+ break;
#if defined(ENABLE_SVR_PASSWORD_AUTH) || defined(ENABLE_SVR_PAM_AUTH)
case 's':
svr_opts.noauthpass = 1;
@@ -274,14 +282,21 @@ void svr_getopts(int argc, char ** argv) {
}
- if (recv_window_arg)
- {
+ 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);
+ }
+ }
}
static void addportandaddress(char* spec) {