mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-13 18:12:03 +08:00
Added the mobile-idle-timeout config option.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user