From: Gert Doering Date: Thu, 16 Oct 2025 12:33:03 +0200 Message-ID: <20251016103308.4685-1-gert@...1296...> In-Reply-To: References: MIME-Version: 1.0 Subject: [Openvpn-devel] [PATCH v1] init: Fix datav2_enabled check in options import List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: openvpn-devel@lists.sourceforge.net From: Frank Lichtenheld peer_id is unsigned, so the previous check was partly useless. Instead check use_peer_id. Change-Id: Ia713a2ecfcad7032863867630a0c306ff9f90385 Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1273 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1273 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Arne Schwabe diff --git a/src/openvpn/init.c b/src/openvpn/init.c index aaa0573..aa2611d 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2728,8 +2728,8 @@ /* Ensure that for epoch data format is only enabled if also data v2 * is enabled */ - bool epoch_data = (c->options.imported_protocol_flags & CO_EPOCH_DATA_KEY_FORMAT); - bool datav2_enabled = (c->options.peer_id >= 0 && c->options.peer_id < MAX_PEER_ID); + bool epoch_data = c->options.imported_protocol_flags & CO_EPOCH_DATA_KEY_FORMAT; + bool datav2_enabled = c->options.use_peer_id && c->options.peer_id < MAX_PEER_ID; if (epoch_data && !datav2_enabled) {