From: Razvan Cojocaru <[email protected]>

Turn the MODE_* defines into enum options_mode and use it for the mode
fields and parameters. With both modes being distinct enum types,
-Wenum-compare catches comparing a context mode against an options
mode.

Change-Id: Ie902dbc45e4aca0c72bc4b4e8cc1e17d29b47aa1
Signed-off-by: Razvan Cojocaru <[email protected]>
Acked-by: Lev Stipakov <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2334
---

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

Acked-by according to Gerrit (reflected above):
Lev Stipakov <[email protected]>

        
diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c
index fdee465..3c85c11 100644
--- a/src/openvpn/dco.c
+++ b/src/openvpn/dco.c
@@ -255,7 +255,7 @@
 }
 
 static bool
-dco_check_option_ce(const struct connection_entry *ce, msglvl_t msglevel, int 
mode)
+dco_check_option_ce(const struct connection_entry *ce, msglvl_t msglevel, enum 
options_mode mode)
 {
     if (ce->fragment)
     {
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 2068393..f9ff0c4 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -2309,7 +2309,7 @@
 }
 
 static void
-options_postprocess_mutate_le(const struct connection_entry *ce, struct 
local_entry *le, int mode)
+options_postprocess_mutate_le(const struct connection_entry *ce, struct 
local_entry *le, enum options_mode mode)
 {
     /* use the global port if none is specified */
     if (!le->port)
diff --git a/src/openvpn/options.h b/src/openvpn/options.h
index b390ebc..0112c5f 100644
--- a/src/openvpn/options.h
+++ b/src/openvpn/options.h
@@ -252,6 +252,13 @@
     struct verify_hash_list *next;
 };
 
+/** Major mode */
+enum options_mode
+{
+    MODE_POINT_TO_POINT,
+    MODE_SERVER,
+};
+
 /* Command line options */
 struct options
 {
@@ -260,10 +267,7 @@
     /* first config file */
     const char *config;
 
-    /* major mode */
-#define MODE_POINT_TO_POINT 0
-#define MODE_SERVER         1
-    int mode;
+    enum options_mode mode;
 
     /* enable forward compatibility for post-2.1 features */
     bool forward_compatible;
diff --git a/src/openvpn/ssl_common.h b/src/openvpn/ssl_common.h
index cfe3fea..fe333a3 100644
--- a/src/openvpn/ssl_common.h
+++ b/src/openvpn/ssl_common.h
@@ -324,7 +324,7 @@
 
     /* from command line */
     bool single_session;
-    int mode;
+    enum options_mode mode;
     bool pull;
     /**
      * The detail of info we push in peer info


_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to