mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-12 01:26:48 +08:00
Enable maintainance when maximum TLS sessions have been reached. Set more sane defaults for max sessions.
This commit is contained in:
+1
-1
@@ -47,7 +47,7 @@ int store_cookie_hash(main_server_st *s, struct stored_cookie_st* sc)
|
||||
size_t key;
|
||||
|
||||
if (s->cookie_db->entries >= MAX_COOKIES(s->config->max_clients)) {
|
||||
syslog(LOG_INFO, "Maximum number of cookies was reached (%u)", MAX_COOKIES(s->config->max_clients));
|
||||
mslog(s, NULL, LOG_INFO, "Maximum number of cookies was reached (%u)", MAX_COOKIES(s->config->max_clients));
|
||||
need_maintainance = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
+6
-4
@@ -142,17 +142,19 @@ int handle_resume_store_req(main_server_st* s, struct proc_st * proc,
|
||||
{
|
||||
tls_cache_st* cache;
|
||||
size_t key;
|
||||
unsigned int max;
|
||||
|
||||
if (req->session_id_size > GNUTLS_MAX_SESSION_ID)
|
||||
return -1;
|
||||
if (req->session_data_size > MAX_SESSION_DATA_SIZE)
|
||||
return -1;
|
||||
|
||||
if ((s->config->max_clients != 0 &&
|
||||
s->tls_db->entries >= MAX(s->config->max_clients, DEFAULT_MAX_CACHED_TLS_SESSIONS(s->tls_db))) ||
|
||||
(s->config->max_clients == 0 &&
|
||||
s->tls_db->entries >= DEFAULT_MAX_CACHED_TLS_SESSIONS(s->tls_db)))
|
||||
max = MAX(2*s->config->max_clients, DEFAULT_MAX_CACHED_TLS_SESSIONS);
|
||||
if (s->tls_db->entries >= max) {
|
||||
mslog(s, NULL, LOG_INFO, "Maximum number of stored TLS sessions reached (%u)", max);
|
||||
need_maintainance = 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
key = hash_stable_8(req->session_id, req->session_id_size, 0);
|
||||
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ typedef struct
|
||||
} tls_cache_st;
|
||||
|
||||
#define TLS_SESSION_EXPIRATION_TIME 600
|
||||
#define DEFAULT_MAX_CACHED_TLS_SESSIONS(db) 256
|
||||
#define DEFAULT_MAX_CACHED_TLS_SESSIONS 64
|
||||
|
||||
void tls_cache_init(hash_db_st** db);
|
||||
void tls_cache_deinit(hash_db_st* db);
|
||||
|
||||
Reference in New Issue
Block a user