Added the mobile-idle-timeout config option.

This commit is contained in:
Nikos Mavrogiannopoulos
2014-02-18 18:54:50 +01:00
parent b550489c88
commit 6ee0899e22
4 changed files with 17 additions and 11 deletions
+2
View File
@@ -92,6 +92,7 @@ static struct cfg_options available_options[] = {
{ .name = "rekey-time", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "auth-timeout", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "idle-timeout", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "mobile-idle-timeout", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "max-clients", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "min-reauth-time", .type = OPTION_NUMERIC, .mandatory = 0 },
{ .name = "max-same-clients", .type = OPTION_NUMERIC, .mandatory = 0 },
@@ -394,6 +395,7 @@ unsigned force_cert_auth;
READ_NUMERIC("auth-timeout", config->auth_timeout);
READ_NUMERIC("idle-timeout", config->idle_timeout);
READ_NUMERIC("mobile-idle-timeout", config->mobile_idle_timeout);
READ_NUMERIC("max-clients", config->max_clients);
READ_NUMERIC("min-reauth-time", config->min_reauth_time);
READ_NUMERIC("max-same-clients", config->max_same_clients);
+4
View File
@@ -187,6 +187,10 @@ auth-timeout = 40
# before being disconnected. Unset to disable.
#idle-timeout = 1200
# The time (in seconds) that a mobile client is allowed to stay idle (no
# traffic) before being disconnected. Unset to disable.
#mobile-idle-timeout = 2400
# The time (in seconds) that a client is not allowed to reconnect after
# a failed authentication attempt.
#min-reauth-time = 2
+1
View File
@@ -204,6 +204,7 @@ struct cfg_st {
time_t min_reauth_time; /* after a failed auth, how soon one can reauthenticate -> in seconds */
unsigned auth_timeout; /* timeout of HTTP auth */
unsigned idle_timeout; /* timeout when idle */
unsigned mobile_idle_timeout; /* timeout when a mobile is idle */
unsigned keepalive;
unsigned dpd;
unsigned mobile_dpd;
+10 -11
View File
@@ -1030,7 +1030,6 @@ static int connect_handler(worker_st * ws)
struct http_req_st *req = &ws->req;
fd_set rfds;
int l, e, max, ret, overhead, t;
int dpd;
unsigned tls_retry, dtls_mtu, cstp_mtu;
char *p;
#ifdef HAVE_PSELECT
@@ -1121,14 +1120,14 @@ static int connect_handler(worker_st * ws)
ret = tls_puts(ws->session, "X-CSTP-Version: 1\r\n");
SEND_ERR(ret);
if (req->is_mobile)
dpd = ws->config->mobile_dpd;
else
dpd = ws->config->dpd;
if (req->is_mobile) {
ws->config->dpd = ws->config->mobile_dpd;
ws->config->idle_timeout = ws->config->mobile_idle_timeout;
}
oclog(ws, LOG_DEBUG, "suggesting DPD of %d secs", dpd);
if (dpd > 0) {
ret = tls_printf(ws->session, "X-CSTP-DPD: %u\r\n", dpd);
oclog(ws, LOG_DEBUG, "suggesting DPD of %d secs", ws->config->dpd);
if (ws->config->dpd > 0) {
ret = tls_printf(ws->session, "X-CSTP-DPD: %u\r\n", ws->config->dpd);
SEND_ERR(ret);
}
@@ -1363,8 +1362,8 @@ static int connect_handler(worker_st * ws)
ws->buffer);
SEND_ERR(ret);
if (dpd > 0) {
ret = tls_printf(ws->session, "X-DTLS-DPD: %u\r\n", dpd);
if (ws->config->dpd > 0) {
ret = tls_printf(ws->session, "X-DTLS-DPD: %u\r\n", ws->config->dpd);
SEND_ERR(ret);
}
@@ -1545,7 +1544,7 @@ static int connect_handler(worker_st * ws)
gettime(&tnow);
now = tnow.tv_sec;
if (periodic_check(ws, mtu_overhead, now, dpd) < 0)
if (periodic_check(ws, mtu_overhead, now, ws->config->dpd) < 0)
goto exit;
if (FD_ISSET(ws->tun_fd, &rfds)) {