From 6522ff3c66063f35eb906877f4848f550fb4d8f7 Mon Sep 17 00:00:00 2001 From: pushan <62173185+pushan01@users.noreply.github.com> Date: Thu, 19 Oct 2023 10:11:19 -0500 Subject: [PATCH] fix(ssl): init peer_id when init tls_multi When openvpn run in UDP server mode, if ssl connections reach the max clients, the next connection would be failed in `multi_create_instance` and the half connection will be close in `multi_close_instance`, which may lead array `m->instances[0]` covered unexpectedly and make the first connection interrupt, this patch fix this problem by init `peer_id` with `MAX_PEER_ID` in `tils_multi_init`. --- src/openvpn/ssl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 5e6205cc2fb..c4420b2ed30 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -64,6 +64,7 @@ #include "dco.h" #include "memdbg.h" +#include "openvpn.h" #ifdef MEASURE_TLS_HANDSHAKE_STATS @@ -1312,6 +1313,7 @@ tls_multi_init(struct tls_options *tls_options) /* get command line derived options */ ret->opt = *tls_options; ret->dco_peer_id = -1; + ret->peer_id = MAX_PEER_ID; return ret; }