[Openvpn-devel,v1] init: compare context mode against CM_P2P in do_up()

Message ID 20261124122628.8605-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v1] init: compare context mode against CM_P2P in do_up() |

Commit Message

Gert Doering Nov. 24, 2026, 12:26 p.m. UTC
  From: Razvan Cojocaru <razvanc@mailbox.org>

c->mode holds a CM_* value, but do_up() compared it against
MODE_POINT_TO_POINT, an options mode. This only worked because both
are 0.

While at it, drop a duplicate #include "occ.h".

Change-Id: I878ba525232afffa95e6b7c972ae349d6b488a2d
Signed-off-by: Razvan Cojocaru <razvanc@mailbox.org>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2332
---

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/+/2332
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Lev Stipakov <lstipakov@gmail.com>
  

Patch

diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index e1052c5..8b64944 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -39,7 +39,6 @@ 
 #include "otime.h"
 #include "pool.h"
 #include "gremlin.h"
-#include "occ.h"
 #include "pkcs11.h"
 #include "ps.h"
 #include "lladdr.h"
@@ -2363,7 +2362,7 @@ 
     if (!c->c2.do_up_ran
         || (c->c2.tls_multi && c->c2.tls_multi->multi_state == CAS_RECONNECT_PENDING))
     {
-        if (c->mode == MODE_POINT_TO_POINT)
+        if (c->mode == CM_P2P)
         {
             /* ovpn-dco requires adding the peer now, before any option can be set,
              * but *after* having parsed the pushed peer-id in do_deferred_options()
@@ -2391,7 +2390,7 @@ 
         }
         else
         {
-            if (c->mode == MODE_POINT_TO_POINT)
+            if (c->mode == CM_P2P)
             {
                 if (!do_deferred_p2p_ncp(c))
                 {