]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
init: Fix datav2_enabled check in options import
authorFrank Lichtenheld <frank@lichtenheld.com>
Thu, 16 Oct 2025 10:33:03 +0000 (12:33 +0200)
committerGert Doering <gert@greenie.muc.de>
Thu, 16 Oct 2025 10:42:25 +0000 (12:42 +0200)
peer_id is unsigned, so the previous check was partly
useless. Instead check use_peer_id.

Change-Id: Ia713a2ecfcad7032863867630a0c306ff9f90385
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1273
Message-Id: <20251016103308.4685-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33365.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/init.c

index aaa05737bb942af89084ae4e53ace8e246c153ad..aa2611dbc329dac93da0c4e5d74d18cb766e137c 100644 (file)
@@ -2728,8 +2728,8 @@ do_deferred_options(struct context *c, const unsigned int found, const bool is_u
 
     /* 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)
     {