: Handle exceeding max-clients
PATCH 1/1 : Handle exceeding max-clients
This patch fixes a crash we've seen on server instances when one more client than 'max-clients' connects.
I believe this affects both master and DCO branches, and I think it was introduced with this commit:
commit b364711486dc6371ad2659a5aa190941136f4f04 Author: Arne Schwabe <[email protected]...> Date: Mon May 2 17:43:10 2022 +0200 Implement stateless HMAC-based sesssion-id three-way-handshake
Best regards,
Kristof
PATCH 1/1 Handle exceeding 'max-clients'
From: Kristof Provost <[email protected]...>
If 'max-clients' is set multi_create_instance() can return NULL (for any client that would take us over the client limit).
If mi is NULL we don't add it to the hash map, but we do potentially dereference it to increment the session count.
Do not attempt to do so if 'mi == NULL'.
--- src/openvpn/mudp.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
src/openvpn/mudp.c +10 -9
@@ -241,15 +241,16 @@ multi_get_create_instance_udp(struct multi_context *m, bool *floated)hash_add_fast (hash, bucket, &mi->real, hv, mi); mi->did_real_hash = true;multi_assign_peer_id (m, mi); - } -/* If we have a session id already, ensure that the -* state is using the same */ -if (session_id_defined (&state.server_session_id) - &&session_id_defined ((&state.peer_session_id))) - { - mi->context.c2.tls_multi->n_sessions++; -struct tls_session *session = &mi->context.c2.tls_multi->session[TM_ACTIVE ]; -session_skip_to_pre_start (session, &state, &m->top.c2.from); + +/* If we have a session id already, ensure that the +* state is using the same */ +if (session_id_defined (&state.server_session_id) + &&session_id_defined ((&state.peer_session_id))) + { + mi->context.c2.tls_multi->n_sessions++; +struct tls_session *session = &mi->context.c2.tls_multi->session[TM_ACTIVE ]; +session_skip_to_pre_start (session, &state, &m->top.c2.from); + } } }else
Signature · 1 line
2.37.0
Re: [Openvpn-devel] [PATCH] Handle exceeding 'max-clients'
Am 13.07.22 um 10:34 schrieb Kristof Provost via Openvpn-devel:
Quoted 8 lines
From: Kristof Provost <[email protected]...>
If 'max-clients' is set
multi_create_instance()can return NULL (for any client that would take us over the client limit).If mi is NULL we don't add it to the hash map, but we do potentially dereference it to increment the session count.
Do not attempt to do so if 'mi == NULL'.
Oops. This patch also becomes much easier to review with ignoring whitespace. Then the change is just moving the }
[Openvpn-devel] [PATCH applied] Re: Handle exceeding 'max-clients'
In reply to Kristof ProvostQuite obvious in hindsight ;-) - good catch.
Your patch has been applied to the master branch.
commit 6e47cadd6219a8a9da8c2c1558652bbbbf274a10
Author: Kristof Provost Date: Wed Jul 13 10:34:04 2022 +0200
Handle exceeding 'max-clients'
Signed-off-by: Kristof Provost <[email protected]...>
Acked-by: Arne Schwabe <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg24678.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Re: [Openvpn-devel] [PATCH applied] Re: Handle exceeding 'max-clients'
Hi,
Quoted 5 lines · Gert Doering
Quite obvious in hindsight ;-) - good catch.
Your patch has been applied to the master branch.
commit
6e47cadd6219a8a9da8c2c1558652bbbbf274a10
Apologies. My tree was not clean, so this commit ID is wrong.
I noticed before pushing, but after having sent this e-mail - so the right commit ID for this is
commit ac14d90e7e5a80c57d064b1d3a5deb1db63b0911 (HEAD -> master)
Author: Kristof Provost <[email protected]...> Date: Wed Jul 13 10:34:04 2022 +0200
Handle exceeding 'max-clients'
which goes on top of
commit ad085464b15d63324846d0a5151141f58ccb5a34
Author: Antonio Quartulli <[email protected]...> Date: Mon Jul 11 14:23:48 2022 +0200
options: don't export local function pre_connect_save()
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...