From: "cron2 (Code Review)" Date: Fri, 19 Sep 2025 14:51:31 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., antonio@...2726... Message-ID: <8bc89d7a6a3d4beef5166f2e6b21f63e59856d21-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="1VllKtja4lk="; charset=UTF-8 Subject: [Openvpn-devel] [L] Change in openvpn[master]: Introduce msglvl_t to unify msglevel type handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --1VllKtja4lk= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#17) to the change originally created b= y flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1110?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2, Code-Review+2 by ordex Change subject: Introduce msglvl_t to unify msglevel type handling ...................................................................... Introduce msglvl_t to unify msglevel type handling msglevel was definitely unsigned as the first argument to msg(), but many parts of the code had it as signed. So this produced a LOT of warnings when enabling -Wsign-conversion. Introduce a msglvl_t typedef and switch all users to it. This includes any values that are stored in the msglevel field, including debug level and mute level. There is one exception in struct status_output where -1 is a valid value in the API. Only positive values are translated into standard message levels. Change-Id: Id492cb774c6d022d06bb3cf5fec2a4bdd410e619 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1110 Message-Id: <20250917170428.3310-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33= 028.html Signed-off-by: Gert Doering --- M src/openvpn/argv.c M src/openvpn/argv.h M src/openvpn/buffer.c M src/openvpn/clinat.c M src/openvpn/clinat.h M src/openvpn/comp.c M src/openvpn/comp.h M src/openvpn/crypto.c M src/openvpn/crypto.h M src/openvpn/dco.c M src/openvpn/dco.h M src/openvpn/dco_freebsd.c M src/openvpn/dco_linux.c M src/openvpn/dco_win.c M src/openvpn/dns.c M src/openvpn/dns.h M src/openvpn/env_set.c M src/openvpn/env_set.h M src/openvpn/error.c M src/openvpn/error.h M src/openvpn/forward.c M src/openvpn/forward.h M src/openvpn/init.c M src/openvpn/init.h M src/openvpn/manage.c M src/openvpn/manage.h M src/openvpn/mtu.c M src/openvpn/mtu.h M src/openvpn/multi.c M src/openvpn/options.c M src/openvpn/options.h M src/openvpn/options_util.c M src/openvpn/options_util.h M src/openvpn/packet_id.c M src/openvpn/pkcs11.c M src/openvpn/plugin.c M src/openvpn/plugin.h M src/openvpn/pool.c M src/openvpn/pool.h M src/openvpn/proto.c M src/openvpn/push.c M src/openvpn/push.h M src/openvpn/route.c M src/openvpn/route.h M src/openvpn/run_command.c M src/openvpn/run_command.h M src/openvpn/sig.c M src/openvpn/sig.h M src/openvpn/socket.c M src/openvpn/socket_util.c M src/openvpn/socket_util.h M src/openvpn/ssl_verify_backend.h M src/openvpn/ssl_verify_mbedtls.c M src/openvpn/ssl_verify_openssl.c M src/openvpn/status.c M src/openvpn/status.h M src/openvpn/tun.c M src/openvpn/tun.h M tests/unit_tests/openvpn/mock_msg.c M tests/unit_tests/openvpn/mock_msg.h M tests/unit_tests/openvpn/mock_ssl_dependencies.c M tests/unit_tests/openvpn/test_argv.c M tests/unit_tests/openvpn/test_misc.c M tests/unit_tests/openvpn/test_pkcs11.c M tests/unit_tests/openvpn/test_pkt.c M tests/unit_tests/openvpn/test_push_update_msg.c M tests/unit_tests/openvpn/test_socket.c M tests/unit_tests/openvpn/test_tls_crypt.c M tests/unit_tests/openvpn/test_user_pass.c 69 files changed, 283 insertions(+), 275 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/10/1110/17 diff --git a/src/openvpn/argv.c b/src/openvpn/argv.c index 903fc0a..79b541a 100644 --- a/src/openvpn/argv.c +++ b/src/openvpn/argv.c @@ -235,14 +235,14 @@ /** * Write the arguments stored in a struct argv via the msg() command. * - * @param msglev Integer with the message level used by msg(). - * @param a Valid pointer to the struct argv with the arguments to = write. + * @param msglevel Integer with the message level used by msg(). + * @param a Valid pointer to the struct argv with the arguments t= o write. */ void -argv_msg(const int msglev, const struct argv *a) +argv_msg(const msglvl_t msglevel, const struct argv *a) { struct gc_arena gc =3D gc_new(); - msg(msglev, "%s", argv_str(a, &gc, 0)); + msg(msglevel, "%s", argv_str(a, &gc, 0)); gc_free(&gc); } @@ -250,16 +250,16 @@ * Similar to argv_msg() but prefixes the messages being written with a * given string. * - * @param msglev Integer with the message level used by msg(). - * @param a Valid pointer to the struct argv with the arguments to = write - * @param prefix Valid pointer to the prefix string + * @param msglevel Integer with the message level used by msg(). + * @param a Valid pointer to the struct argv with the arguments t= o write + * @param prefix Valid pointer to the prefix string * */ void -argv_msg_prefix(const int msglev, const struct argv *a, const char *prefix) +argv_msg_prefix(const msglvl_t msglevel, const struct argv *a, const char = *prefix) { struct gc_arena gc =3D gc_new(); - msg(msglev, "%s: %s", prefix, argv_str(a, &gc, 0)); + msg(msglevel, "%s: %s", prefix, argv_str(a, &gc, 0)); gc_free(&gc); } diff --git a/src/openvpn/argv.h b/src/openvpn/argv.h index 056fe31..969d7b1 100644 --- a/src/openvpn/argv.h +++ b/src/openvpn/argv.h @@ -47,9 +47,9 @@ struct argv argv_insert_head(const struct argv *a, const char *head); -void argv_msg(const int msglev, const struct argv *a); +void argv_msg(const msglvl_t msglevel, const struct argv *a); -void argv_msg_prefix(const int msglev, const struct argv *a, const char *p= refix); +void argv_msg_prefix(const msglvl_t msglevel, const struct argv *a, const = char *prefix); void argv_parse_cmd(struct argv *a, const char *s); diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index 0f0d17e..c0b85b2 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -1127,7 +1127,7 @@ { if (buf && buf->len) { - int msglevel =3D D_ALIGN_DEBUG; + msglvl_t msglevel =3D D_ALIGN_DEBUG; const unsigned int u =3D (unsigned int)BPTR(buf); if (u & (PAYLOAD_ALIGN - 1)) diff --git a/src/openvpn/clinat.c b/src/openvpn/clinat.c index 48a2057..b49d4bb 100644 --- a/src/openvpn/clinat.c +++ b/src/openvpn/clinat.c @@ -47,7 +47,7 @@ } void -print_client_nat_list(const struct client_nat_option_list *list, int msgle= vel) +print_client_nat_list(const struct client_nat_option_list *list, msglvl_t = msglevel) { struct gc_arena gc =3D gc_new(); int i; @@ -101,7 +101,7 @@ void add_client_nat_to_option_list(struct client_nat_option_list *dest, const c= har *type, const char *network, const char *netmask, co= nst char *foreign_network, - int msglevel) + msglvl_t msglevel) { struct client_nat_entry e; bool ok; @@ -159,7 +159,7 @@ #endif static void -print_pkt(struct openvpn_iphdr *iph, const char *prefix, const int directi= on, const int msglevel) +print_pkt(struct openvpn_iphdr *iph, const char *prefix, const int directi= on, const msglvl_t msglevel) { struct gc_arena gc =3D gc_new(); diff --git a/src/openvpn/clinat.h b/src/openvpn/clinat.h index abfa0b7..7d787e0 100644 --- a/src/openvpn/clinat.h +++ b/src/openvpn/clinat.h @@ -54,11 +54,11 @@ void copy_client_nat_option_list(struct client_nat_option_list *dest, const struct client_nat_option_list *src); -void print_client_nat_list(const struct client_nat_option_list *list, int = msglevel); +void print_client_nat_list(const struct client_nat_option_list *list, msgl= vl_t msglevel); void add_client_nat_to_option_list(struct client_nat_option_list *dest, co= nst char *type, const char *network, const char *netmas= k, - const char *foreign_network, int msglev= el); + const char *foreign_network, msglvl_t m= sglevel); void client_nat_transform(const struct client_nat_option_list *list, struc= t buffer *ipbuf, const int direction); diff --git a/src/openvpn/comp.c b/src/openvpn/comp.c index 1a2e775..9d35141 100644 --- a/src/openvpn/comp.c +++ b/src/openvpn/comp.c @@ -159,7 +159,7 @@ #endif /* USE_COMP */ bool -check_compression_settings_valid(struct compress_options *info, int msglev= el) +check_compression_settings_valid(struct compress_options *info, msglvl_t m= sglevel) { /* * We also allow comp-stub-v2 here as it technically allows escaping of diff --git a/src/openvpn/comp.h b/src/openvpn/comp.h index 0354896..1717029 100644 --- a/src/openvpn/comp.h +++ b/src/openvpn/comp.h @@ -84,12 +84,14 @@ && info->alg !=3D COMP_ALG_UNDEF; } +#include "error.h" + /** * Checks if the compression settings are valid. Takes into account the * flags of allow-compression and also the whether algorithms are compiled * in */ -bool check_compression_settings_valid(struct compress_options *info, int m= sglevel); +bool check_compression_settings_valid(struct compress_options *info, msglv= l_t msglevel); #ifdef USE_COMP #include "buffer.h" diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index 4c0f684..0abcd7f 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -1609,7 +1609,7 @@ } int -ascii2keydirection(int msglevel, const char *str) +ascii2keydirection(msglvl_t msglevel, const char *str) { if (!str) { diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h index efd7f60..d69db59 100644 --- a/src/openvpn/crypto.h +++ b/src/openvpn/crypto.h @@ -618,7 +618,7 @@ void must_have_n_keys(const char *filename, const char *option, const stru= ct key2 *key2, int n); -int ascii2keydirection(int msglevel, const char *str); +int ascii2keydirection(msglvl_t msglevel, const char *str); const char *keydirection2ascii(int kd, bool remote, bool humanreadable); diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c index 70a8c0a..881459c 100644 --- a/src/openvpn/dco.c +++ b/src/openvpn/dco.c @@ -233,7 +233,7 @@ } static bool -dco_check_option_ce(const struct connection_entry *ce, int msglevel, int m= ode) +dco_check_option_ce(const struct connection_entry *ce, msglvl_t msglevel, = int mode) { if (ce->fragment) { @@ -293,7 +293,7 @@ } bool -dco_check_startup_option(int msglevel, const struct options *o) +dco_check_startup_option(msglvl_t msglevel, const struct options *o) { /* check if no dev name was specified at all. In the case, * later logic will most likely stop OpenVPN, so no need to @@ -430,7 +430,7 @@ } bool -dco_check_option(int msglevel, const struct options *o) +dco_check_option(msglvl_t msglevel, const struct options *o) { /* At this point the ciphers have already been normalised */ if (o->enable_ncp_fallback @@ -480,7 +480,7 @@ } bool -dco_check_pull_options(int msglevel, const struct options *o) +dco_check_pull_options(msglvl_t msglevel, const struct options *o) { if (!o->use_peer_id) { diff --git a/src/openvpn/dco.h b/src/openvpn/dco.h index 59acb18..a362977 100644 --- a/src/openvpn/dco.h +++ b/src/openvpn/dco.h @@ -55,7 +55,7 @@ * @param msglevel level to print messages to * @return true if ovpn-dco is available, false otherwise */ -bool dco_available(int msglevel); +bool dco_available(msglvl_t msglevel); /** @@ -75,7 +75,7 @@ * @param o the options struct that hold the options * @return true if no conflict was detected, false otherwise */ -bool dco_check_option(int msglevel, const struct options *o); +bool dco_check_option(msglvl_t msglevel, const struct options *o); /** * Check whether the options struct has any further option that is not sup= ported @@ -87,7 +87,7 @@ * @param o the options struct that hold the options * @return true if no conflict was detected, false otherwise */ -bool dco_check_startup_option(int msglevel, const struct options *o); +bool dco_check_startup_option(msglvl_t msglevel, const struct options *o); /** * Check whether any of the options pushed by the server is not supported = by @@ -98,7 +98,7 @@ * @param o the options struct that hold the options * @return true if no conflict was detected, false otherwise */ -bool dco_check_pull_options(int msglevel, const struct options *o); +bool dco_check_pull_options(msglvl_t msglevel, const struct options *o); /** * Initialize the DCO context @@ -261,7 +261,7 @@ typedef void *dco_context_t; static inline bool -dco_available(int msglevel) +dco_available(msglvl_t msglevel) { return false; } @@ -273,19 +273,19 @@ } static inline bool -dco_check_option(int msglevel, const struct options *o) +dco_check_option(msglvl_t msglevel, const struct options *o) { return false; } static inline bool -dco_check_startup_option(int msglevel, const struct options *o) +dco_check_startup_option(msglvl_t msglevel, const struct options *o) { return false; } static inline bool -dco_check_pull_options(int msglevel, const struct options *o) +dco_check_pull_options(msglvl_t msglevel, const struct options *o) { return false; } diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c index 65303cd..d5ca277 100644 --- a/src/openvpn/dco_freebsd.c +++ b/src/openvpn/dco_freebsd.c @@ -658,7 +658,7 @@ } bool -dco_available(int msglevel) +dco_available(msglvl_t msglevel) { struct if_clonereq ifcr; char *buf =3D NULL; diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index 40674e7..d8357ca 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -74,7 +74,7 @@ * @return ID on success, negative error code on error */ static int -resolve_ovpn_netlink_id(int msglevel) +resolve_ovpn_netlink_id(msglvl_t msglevel) { int ret; struct nl_sock *nl_sock =3D nl_socket_alloc(); @@ -1199,7 +1199,7 @@ } bool -dco_available(int msglevel) +dco_available(msglvl_t msglevel) { if (resolve_ovpn_netlink_id(D_DCO_DEBUG) < 0) { diff --git a/src/openvpn/dco_win.c b/src/openvpn/dco_win.c index 01ba017..2d08ed8 100644 --- a/src/openvpn/dco_win.c +++ b/src/openvpn/dco_win.c @@ -599,7 +599,7 @@ } bool -dco_available(int msglevel) +dco_available(msglvl_t msglevel) { /* try to open device by symbolic name */ HANDLE h =3D CreateFile("\\\\.\\ovpn-dco", GENERIC_READ | GENERIC_WRIT= E, 0, NULL, OPEN_EXISTING, diff --git a/src/openvpn/dns.c b/src/openvpn/dns.c index 5421004..efb888a 100644 --- a/src/openvpn/dns.c +++ b/src/openvpn/dns.c @@ -200,7 +200,7 @@ } bool -dns_options_verify(int msglevel, const struct dns_options *o) +dns_options_verify(msglvl_t msglevel, const struct dns_options *o) { const struct dns_server *server =3D o->servers ? o->servers : o->serve= rs_prepull; while (server) diff --git a/src/openvpn/dns.h b/src/openvpn/dns.h index 6d97b40..6cd98f2 100644 --- a/src/openvpn/dns.h +++ b/src/openvpn/dns.h @@ -166,7 +166,7 @@ * @param o Pointer to the DNS options to validate * @return True if no error was found */ -bool dns_options_verify(int msglevel, const struct dns_options *o); +bool dns_options_verify(msglvl_t msglevel, const struct dns_options *o); /** * Makes a deep copy of the passed DNS options. diff --git a/src/openvpn/env_set.c b/src/openvpn/env_set.c index 6c7df8e..2ae71ab 100644 --- a/src/openvpn/env_set.c +++ b/src/openvpn/env_set.c @@ -209,7 +209,7 @@ } void -env_set_print(int msglevel, const struct env_set *es) +env_set_print(msglvl_t msglevel, const struct env_set *es) { if (check_debug_level(msglevel)) { diff --git a/src/openvpn/env_set.h b/src/openvpn/env_set.h index 3973a4e..ddcfa14 100644 --- a/src/openvpn/env_set.h +++ b/src/openvpn/env_set.h @@ -85,7 +85,7 @@ const char *env_set_get(const struct env_set *es, const char *name); -void env_set_print(int msglevel, const struct env_set *es); +void env_set_print(msglvl_t msglevel, const struct env_set *es); /** * Write a struct env_set to a file. Each item on one line. diff --git a/src/openvpn/error.c b/src/openvpn/error.c index 1b98235..58c2fd1 100644 --- a/src/openvpn/error.c +++ b/src/openvpn/error.c @@ -48,12 +48,12 @@ #endif /* Globals */ -unsigned int x_debug_level; /* GLOBAL */ +msglvl_t x_debug_level; /* GLOBAL */ /* Mute state */ -static int mute_cutoff; /* GLOBAL */ -static int mute_count; /* GLOBAL */ -static int mute_category; /* GLOBAL */ +static int mute_cutoff; /* GLOBAL */ +static int mute_count; /* GLOBAL */ +static msglvl_t mute_category; /* GLOBAL */ /* * Output mode priorities are as follows: @@ -103,16 +103,14 @@ bool set_debug_level(const int level, const unsigned int flags) { - const int ceiling =3D 15; - - if (level >=3D 0 && level <=3D ceiling) + if (level >=3D 0 && level <=3D M_DEBUG_LEVEL) { - x_debug_level =3D level; + x_debug_level =3D (msglvl_t)level; return true; } else if (flags & SDL_CONSTRAIN) { - x_debug_level =3D constrain_int(level, 0, ceiling); + x_debug_level =3D (msglvl_t)constrain_int(level, 0, M_DEBUG_LEVEL); return true; } return false; @@ -132,7 +130,7 @@ } } -int +msglvl_t get_debug_level(void) { return x_debug_level; @@ -190,7 +188,7 @@ * Return a file to print messages to before syslog is opened. */ FILE * -msg_fp(const unsigned int flags) +msg_fp(const msglvl_t flags) { FILE *fp =3D msgfp; if (!fp) @@ -214,7 +212,7 @@ int x_msg_line_num; /* GLOBAL */ void -x_msg(const unsigned int flags, const char *format, ...) +x_msg(const msglvl_t flags, const char *format, ...) { va_list arglist; va_start(arglist, format); @@ -235,7 +233,7 @@ } void -x_msg_va(const unsigned int flags, const char *format, va_list arglist) +x_msg_va(const msglvl_t flags, const char *format, va_list arglist) { struct gc_arena gc; #if SYSLOG_CAPABILITY @@ -385,13 +383,13 @@ * Apply muting filter. */ bool -dont_mute(unsigned int flags) +dont_mute(msglvl_t flags) { bool ret =3D true; if (mute_cutoff > 0 && !(flags & M_NOMUTE)) { - const int mute_level =3D DECODE_MUTE_LEVEL(flags); - if (mute_level > 0 && mute_level =3D=3D mute_category) + const msglvl_t mute_level =3D DECODE_MUTE_LEVEL(flags); + if (mute_level =3D=3D mute_category) { if (mute_count =3D=3D mute_cutoff) { @@ -750,7 +748,7 @@ * Translate msg flags into a string */ const char * -msg_flags_string(const unsigned int flags, struct gc_arena *gc) +msg_flags_string(const msglvl_t flags, struct gc_arena *gc) { struct buffer out =3D alloc_buf_gc(16, gc); if (flags =3D=3D M_INFO) diff --git a/src/openvpn/error.h b/src/openvpn/error.h index 8388f82..2913498 100644 --- a/src/openvpn/error.h +++ b/src/openvpn/error.h @@ -74,31 +74,33 @@ #define openvpn_errno() errno #endif +typedef unsigned int msglvl_t; + /* * These globals should not be accessed directly, * but rather through macros or inline functions defined below. */ -extern unsigned int x_debug_level; +extern msglvl_t x_debug_level; extern int x_msg_line_num; /* msg() flags */ -#define M_DEBUG_LEVEL (0x0F) /* debug level mask */ +#define M_DEBUG_LEVEL (0x0Fu) /* debug level mask */ -#define M_FATAL (1 << 4) /* exit program */ -#define M_NONFATAL (1 << 5) /* non-fatal error */ -#define M_WARN (1 << 6) /* call syslog with LOG_WARNING */ -#define M_DEBUG (1 << 7) +#define M_FATAL (1u << 4) /* exit program */ +#define M_NONFATAL (1u << 5) /* non-fatal error */ +#define M_WARN (1u << 6) /* call syslog with LOG_WARNING */ +#define M_DEBUG (1u << 7) -#define M_ERRNO (1 << 8) /* show errno description */ +#define M_ERRNO (1u << 8) /* show errno description */ -#define M_NOMUTE (1 << 11) /* don't do mute processing */ -#define M_NOPREFIX (1 << 12) /* don't show date/time prefix */ -#define M_USAGE_SMALL (1 << 13) /* fatal options error, call usage_small = */ -#define M_MSG_VIRT_OUT (1 << 14) /* output message through msg_status_outp= ut callback */ -#define M_OPTERR (1 << 15) /* print "Options error:" prefix */ -#define M_NOLF (1 << 16) /* don't print new line */ -#define M_NOIPREFIX (1 << 17) /* don't print instance prefix */ +#define M_NOMUTE (1u << 11) /* don't do mute processing */ +#define M_NOPREFIX (1u << 12) /* don't show date/time prefix */ +#define M_USAGE_SMALL (1u << 13) /* fatal options error, call usage_small= */ +#define M_MSG_VIRT_OUT (1u << 14) /* output message through msg_status_out= put callback */ +#define M_OPTERR (1u << 15) /* print "Options error:" prefix */ +#define M_NOLF (1u << 16) /* don't print new line */ +#define M_NOIPREFIX (1u << 17) /* don't print instance prefix */ /* flag combinations which are frequently used */ #define M_ERR (M_FATAL | M_ERRNO) @@ -112,7 +114,7 @@ * A mute level of 0 is always printed. */ #define MUTE_LEVEL_SHIFT 24 -#define MUTE_LEVEL_MASK 0xFF +#define MUTE_LEVEL_MASK 0xFFu #define ENCODE_MUTE_LEVEL(mute_level) (((mute_level) & MUTE_LEVEL_MASK) <<= MUTE_LEVEL_SHIFT) #define DECODE_MUTE_LEVEL(flags) (((flags) >> MUTE_LEVEL_SHIFT) & MUT= E_LEVEL_MASK) @@ -135,7 +137,7 @@ */ /** Check muting filter */ -bool dont_mute(unsigned int flags); +bool dont_mute(msglvl_t flags); /* Macro to ensure (and teach static analysis tools) we exit on fatal erro= rs */ #define EXIT_FATAL(flags) \ @@ -170,7 +172,7 @@ #define dmsg(flags, ...) #endif -void x_msg(const unsigned int flags, const char *format, ...) +void x_msg(const msglvl_t flags, const char *format, ...) #ifdef __GNUC__ #if __USE_MINGW_ANSI_STDIO __attribute__((format(gnu_printf, 2, 3))) @@ -180,7 +182,7 @@ #endif ; /* should be called via msg above */ -void x_msg_va(const unsigned int flags, const char *format, va_list arglis= t); +void x_msg_va(const msglvl_t flags, const char *format, va_list arglist); /* * Function prototypes @@ -201,16 +203,16 @@ bool set_mute_cutoff(const int cutoff); -int get_debug_level(void); +msglvl_t get_debug_level(void); int get_mute_cutoff(void); -const char *msg_flags_string(const unsigned int flags, struct gc_arena *gc= ); +const char *msg_flags_string(const msglvl_t flags, struct gc_arena *gc); /* * File to print messages to before syslog is opened. */ -FILE *msg_fp(const unsigned int flags); +FILE *msg_fp(const msglvl_t flags); /* Fatal logic errors */ #ifndef ENABLE_SMALL @@ -254,14 +256,14 @@ /* Inline functions */ =20 static inline bool -check_debug_level(unsigned int level) +check_debug_level(msglvl_t level) { return (level & M_DEBUG_LEVEL) <=3D x_debug_level; } /** Return true if flags represent an enabled, not muted log level */ static inline bool -msg_test(unsigned int flags) +msg_test(msglvl_t flags) { return check_debug_level(flags) && dont_mute(flags); } @@ -400,8 +402,8 @@ } /** Convert fatal errors to nonfatal, don't touch other errors */ -static inline unsigned int -nonfatal(const unsigned int err) +static inline msglvl_t +nonfatal(const msglvl_t err) { return err & M_FATAL ? (err ^ M_FATAL) | M_NONFATAL : err; } diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 5d22fa3..12dd6a7 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -368,7 +368,8 @@ } bool -send_control_channel_string_dowork(struct tls_session *session, const char= *str, int msglevel) +send_control_channel_string_dowork(struct tls_session *session, const char= *str, + msglvl_t msglevel) { struct gc_arena gc =3D gc_new(); bool stat; @@ -395,7 +396,7 @@ } bool -send_control_channel_string(struct context *c, const char *str, int msglev= el) +send_control_channel_string(struct context *c, const char *str, msglvl_t m= sglevel) { if (c->c2.tls_multi) { diff --git a/src/openvpn/forward.h b/src/openvpn/forward.h index 79d0f8b..a575faf 100644 --- a/src/openvpn/forward.h +++ b/src/openvpn/forward.h @@ -285,7 +285,7 @@ * @param str - The message to be sent * @param msglevel - Message level to use for logging */ -bool send_control_channel_string(struct context *c, const char *str, int m= sglevel); +bool send_control_channel_string(struct context *c, const char *str, msglv= l_t msglevel); /* * Send a string to remote over the TLS control channel. @@ -303,7 +303,8 @@ * @param msglevel - Message level to use for logging */ -bool send_control_channel_string_dowork(struct tls_session *session, const= char *str, int msglevel); +bool send_control_channel_string_dowork(struct tls_session *session, const= char *str, + msglvl_t msglevel); /** diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 2821cd4..0d7a2ec 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -4273,7 +4273,7 @@ } void -management_show_net_callback(void *arg, const int msglevel) +management_show_net_callback(void *arg, const msglvl_t msglevel) { #ifdef _WIN32 show_routes(msglevel); diff --git a/src/openvpn/init.h b/src/openvpn/init.h index a807874..e89615b 100644 --- a/src/openvpn/init.h +++ b/src/openvpn/init.h @@ -136,7 +136,7 @@ void close_management(void); -void management_show_net_callback(void *arg, const int msglevel); +void management_show_net_callback(void *arg, const msglvl_t msglevel); #endif diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 4decdfe..c675e95 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -1475,7 +1475,7 @@ } else { - msg(M_CLIENT, "SUCCESS: verb=3D%d", get_debug_level()); + msg(M_CLIENT, "SUCCESS: verb=3D%u", get_debug_level()); } } else if (streq(p[0], "mute")) diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h index 7c189ba..bff96d3 100644 --- a/src/openvpn/manage.h +++ b/src/openvpn/manage.h @@ -176,7 +176,7 @@ unsigned int flags; void (*status)(void *arg, const int version, struct status_output *so); - void (*show_net)(void *arg, const int msglevel); + void (*show_net)(void *arg, const msglvl_t msglevel); int (*kill_by_cn)(void *arg, const char *common_name); int (*kill_by_addr)(void *arg, const in_addr_t addr, const int port, c= onst int proto); void (*delete_event)(void *arg, event_t event); diff --git a/src/openvpn/mtu.c b/src/openvpn/mtu.c index a419e32..9c1a772 100644 --- a/src/openvpn/mtu.c +++ b/src/openvpn/mtu.c @@ -187,7 +187,7 @@ } void -frame_print(const struct frame *frame, int level, const char *prefix) +frame_print(const struct frame *frame, msglvl_t msglevel, const char *pref= ix) { struct gc_arena gc =3D gc_new(); struct buffer out =3D alloc_buf_gc(256, &gc); @@ -208,7 +208,7 @@ buf_printf(&out, " ET:%d", frame->extra_tun); buf_printf(&out, " ]"); - msg(level, "%s", out.data); + msg(msglevel, "%s", out.data); gc_free(&gc); } diff --git a/src/openvpn/mtu.h b/src/openvpn/mtu.h index c092461..3bbff6f 100644 --- a/src/openvpn/mtu.h +++ b/src/openvpn/mtu.h @@ -181,7 +181,7 @@ * Function prototypes. */ -void frame_print(const struct frame *frame, int level, const char *prefix); +void frame_print(const struct frame *frame, msglvl_t msglevel, const char = *prefix); void set_mtu_discover_type(socket_descriptor_t sd, int mtu_type, sa_family= _t proto_af); diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 6e4cc42..8676a09 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -3316,7 +3316,7 @@ } else { - int msglevel =3D D_DCO; + msglvl_t msglevel =3D D_DCO; if (dco->dco_message_type =3D=3D OVPN_CMD_DEL_PEER && dco->dco_del_peer_reason =3D=3D OVPN_DEL_PEER_REASON_USERSP= ACE) { diff --git a/src/openvpn/options.c b/src/openvpn/options.c index ae285d9..f1f66b9 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -1107,7 +1107,7 @@ #endif /* ifndef _WIN32 */ static in_addr_t -get_ip_addr(const char *ip_string, int msglevel, bool *error) +get_ip_addr(const char *ip_string, msglvl_t msglevel, bool *error) { unsigned int flags =3D GETADDR_HOST_ORDER; bool succeeded =3D false; @@ -1187,7 +1187,7 @@ * @param gc The returned object will be allocated in this gc */ static struct verify_hash_list * -parse_hash_fingerprint(const char *str, int nbytes, int msglevel, struct g= c_arena *gc) +parse_hash_fingerprint(const char *str, int nbytes, msglvl_t msglevel, str= uct gc_arena *gc) { int i =3D 0; const char *cp =3D str; @@ -1240,7 +1240,8 @@ * @param gc The returned list items will be allocated in this = gc */ static struct verify_hash_list * -parse_hash_fingerprint_multiline(const char *str, int nbytes, int msglevel= , struct gc_arena *gc) +parse_hash_fingerprint_multiline(const char *str, int nbytes, msglvl_t msg= level, + struct gc_arena *gc) { struct gc_arena gc_temp =3D gc_new(); char *lines =3D string_alloc(str, &gc_temp); @@ -1329,7 +1330,7 @@ #endif /* ifdef _WIN32 */ static void -dhcp_option_dns6_parse(const char *parm, struct in6_addr *dns6_list, int *= len, int msglevel) +dhcp_option_dns6_parse(const char *parm, struct in6_addr *dns6_list, int *= len, msglvl_t msglevel) { struct in6_addr addr; if (*len >=3D N_DHCP_ADDR) @@ -1344,7 +1345,7 @@ } static void dhcp_option_address_parse(const char *name, const char *parm, in_addr_t *a= rray, int *len, - int msglevel) + msglvl_t msglevel) { if (*len >=3D N_DHCP_ADDR) { @@ -1480,7 +1481,8 @@ #endif /* ! ENABLE_SMALL */ static void -option_iroute(struct options *o, const char *network_str, const char *netm= ask_str, int msglevel) +option_iroute(struct options *o, const char *network_str, const char *netm= ask_str, + msglvl_t msglevel) { struct iroute *ir; @@ -1506,7 +1508,7 @@ } static void -option_iroute_ipv6(struct options *o, const char *prefix_str, int msglevel) +option_iroute_ipv6(struct options *o, const char *prefix_str, msglvl_t msg= level) { struct iroute_ipv6 *ir; @@ -2063,7 +2065,7 @@ } static struct local_entry * -alloc_local_entry(struct connection_entry *ce, const int msglevel, struct = gc_arena *gc) +alloc_local_entry(struct connection_entry *ce, const msglvl_t msglevel, st= ruct gc_arena *gc) { struct local_list *l =3D alloc_local_list_if_undef(ce, gc); struct local_entry *e; @@ -2104,7 +2106,7 @@ } static struct connection_entry * -alloc_connection_entry(struct options *options, const int msglevel) +alloc_connection_entry(struct options *options, const msglvl_t msglevel) { struct connection_list *l =3D alloc_connection_list_if_undef(options); struct connection_entry *e; @@ -2140,7 +2142,7 @@ } static struct remote_entry * -alloc_remote_entry(struct options *options, const int msglevel) +alloc_remote_entry(struct options *options, const msglvl_t msglevel) { struct remote_list *l =3D alloc_remote_list_if_undef(options); struct remote_entry *e; @@ -2694,7 +2696,7 @@ if (!options->tls_server && !options->tls_client) { - int msglevel =3D M_USAGE; + msglvl_t msglevel =3D M_USAGE; if (options->allow_deprecated_insecure_static_crypto) { msglevel =3D M_INFO; @@ -4566,8 +4568,9 @@ } static void -options_warning_safe_scan2(const int msglevel, const int delim, const bool= report_inconsistent, - const char *p1, const struct buffer *b2_src, co= nst char *b1_name, +options_warning_safe_scan2(const msglvl_t msglevel, const int delim, + const bool report_inconsistent, const char *p1, + const struct buffer *b2_src, const char *b1_nam= e, const char *b2_name) { /* We will stop sending 'key-method', 'keydir', 'proto' and 'tls-auth'= in @@ -4619,9 +4622,9 @@ } static void -options_warning_safe_scan1(const int msglevel, const int delim, const bool= report_inconsistent, - const struct buffer *b1_src, const struct buffe= r *b2_src, - const char *b1_name, const char *b2_name) +options_warning_safe_scan1(const msglvl_t msglevel, const int delim, + const bool report_inconsistent, const struct bu= ffer *b1_src, + const struct buffer *b2_src, const char *b1_nam= e, const char *b2_name) { struct gc_arena gc =3D gc_new(); struct buffer b =3D *b1_src; @@ -4637,7 +4640,7 @@ } static void -options_warning_safe_ml(const int msglevel, char *actual, const char *expe= cted, size_t actual_n) +options_warning_safe_ml(const msglvl_t msglevel, char *actual, const char = *expected, size_t actual_n) { struct gc_arena gc =3D gc_new(); @@ -4729,7 +4732,7 @@ */ int -parse_topology(const char *str, const int msglevel) +parse_topology(const char *str, const msglvl_t msglevel) { if (streq(str, "net30")) { @@ -4785,7 +4788,7 @@ } bool -auth_retry_set(const int msglevel, const char *option) +auth_retry_set(const msglvl_t msglevel, const char *option) { if (streq(option, "interact")) { @@ -4942,7 +4945,7 @@ #if 0 static void -ping_rec_err(int msglevel) +ping_rec_err(msglvl_t msglevel) { msg(msglevel, "only one of --ping-exit or --ping-restart options may b= e specified"); } @@ -4966,7 +4969,7 @@ int parse_line(const char *line, char *p[], const int n, const char *file, con= st int line_num, - int msglevel, struct gc_arena *gc) + msglvl_t msglevel, struct gc_arena *gc) { const int STATE_INITIAL =3D 0; const int STATE_READING_QUOTED_PARM =3D 1; @@ -5271,24 +5274,25 @@ } static void add_option(struct options *options, char *p[], bool is_inline,= const char *file, - int line, const int level, const int msglevel, + int line, const int level, const msglvl_t msglevel, const unsigned int permission_mask, unsigned int *o= ption_types_found, struct env_set *es); static void remove_option(struct context *c, struct options *options, char= *p[], bool is_inline, - const char *file, int line, const int msglevel, + const char *file, int line, const msglvl_t msgle= vel, const unsigned int permission_mask, unsigned int= *option_types_found, struct env_set *es); static void update_option(struct context *c, struct options *options, char= *p[], bool is_inline, - const char *file, int line, const int level, con= st int msglevel, + const char *file, int line, const int level, con= st msglvl_t msglevel, const unsigned int permission_mask, unsigned int= *option_types_found, struct env_set *es, unsigned int *update_options= _found); static void read_config_file(struct options *options, const char *file, int level, con= st char *top_file, - const int top_line, const int msglevel, const unsigned in= t permission_mask, - unsigned int *option_types_found, struct env_set *es) + const int top_line, const msglvl_t msglevel, + const unsigned int permission_mask, unsigned int *option_= types_found, + struct env_set *es) { const int max_recursive_levels =3D 10; FILE *fp; @@ -5360,7 +5364,7 @@ static void read_config_string(const char *prefix, struct options *options, const char= *config, - const int msglevel, const unsigned int permission_mask, + const msglvl_t msglevel, const unsigned int permission_= mask, unsigned int *option_types_found, struct env_set *es) { char line[OPTION_LINE_SIZE]; @@ -5388,7 +5392,7 @@ } void -parse_argv(struct options *options, const int argc, char *argv[], const in= t msglevel, +parse_argv(struct options *options, const int argc, char *argv[], const ms= glvl_t msglevel, const unsigned int permission_mask, unsigned int *option_types_= found, struct env_set *es) { /* usage message */ @@ -5457,7 +5461,7 @@ char line[OPTION_PARM_SIZE]; int line_num =3D 0; const char *file =3D "[PUSH-OPTIONS]"; - const int msglevel =3D D_PUSH_ERRORS | M_OPTERR; + const msglvl_t msglevel =3D D_PUSH_ERRORS | M_OPTERR; unsigned int update_options_found =3D 0; while (buf_parse(buf, ',', line, sizeof(line))) @@ -5514,7 +5518,7 @@ } void -options_server_import(struct options *o, const char *filename, int msgleve= l, +options_server_import(struct options *o, const char *filename, msglvl_t ms= glevel, unsigned int permission_mask, unsigned int *option_t= ypes_found, struct env_set *es) { @@ -5524,7 +5528,7 @@ } void -options_string_import(struct options *options, const char *config, const i= nt msglevel, +options_string_import(struct options *options, const char *config, const m= sglvl_t msglevel, const unsigned int permission_mask, unsigned int *op= tion_types_found, struct env_set *es) { @@ -5543,7 +5547,7 @@ static bool verify_permission(const char *name, const char *file, int line, const unsi= gned int type, - const unsigned int allowed, unsigned int *found, const i= nt msglevel, + const unsigned int allowed, unsigned int *found, const m= sglvl_t msglevel, struct options *options, bool is_inline) { if (!(type & allowed)) @@ -5595,7 +5599,7 @@ #define NM_QUOTE_HINT (1 << 0) static bool -no_more_than_n_args(const int msglevel, char *p[], const int max, const un= signed int flags) +no_more_than_n_args(const msglvl_t msglevel, char *p[], const int max, con= st unsigned int flags) { const int len =3D string_array_len((const char **)p); @@ -5619,8 +5623,8 @@ } } -static inline int -msglevel_forward_compatible(struct options *options, const int msglevel) +static inline msglvl_t +msglevel_forward_compatible(struct options *options, const msglvl_t msglev= el) { return options->forward_compatible ? M_WARN : msglevel; } @@ -5654,10 +5658,11 @@ */ static void remove_option(struct context *c, struct options *options, char *p[], bool = is_inline, - const char *file, int line, const int msglevel, const unsign= ed int permission_mask, - unsigned int *option_types_found, struct env_set *es) + const char *file, int line, const msglvl_t msglevel, + const unsigned int permission_mask, unsigned int *option_typ= es_found, + struct env_set *es) { - int msglevel_fc =3D msglevel_forward_compatible(options, msglevel); + msglvl_t msglevel_fc =3D msglevel_forward_compatible(options, msglevel= ); if (streq(p[0], "ifconfig") && !p[1]) { @@ -5792,11 +5797,10 @@ #endif else { - int i; - int msglevel_unknown =3D msglevel_fc; + msglvl_t msglevel_unknown =3D msglevel_fc; /* Check if an option is in --ignore-unknown-option and * set warning level to non fatal */ - for (i =3D 0; options->ignore_unknown_option && options->ignore_un= known_option[i]; i++) + for (int i =3D 0; options->ignore_unknown_option && options->ignor= e_unknown_option[i]; i++) { if (streq(p[0], options->ignore_unknown_option[i])) { @@ -5815,7 +5819,7 @@ static bool -check_route_option(struct options *options, char *p[], const int msglevel,= bool pull_mode) +check_route_option(struct options *options, char *p[], const msglvl_t msgl= evel, bool pull_mode) { rol_check_alloc(options); if (pull_mode) @@ -5843,7 +5847,7 @@ static bool -check_route6_option(struct options *options, char *p[], const int msglevel= , bool pull_mode) +check_route6_option(struct options *options, char *p[], const msglvl_t msg= level, bool pull_mode) { rol6_check_alloc(options); if (pull_mode) @@ -5864,7 +5868,7 @@ } static bool -check_dns_option(struct options *options, char *p[], const int msglevel, b= ool pull_mode) +check_dns_option(struct options *options, char *p[], const msglvl_t msglev= el, bool pull_mode) { if (streq(p[1], "search-domains") && p[2]) { @@ -5984,7 +5988,7 @@ */ static void update_option(struct context *c, struct options *options, char *p[], bool = is_inline, - const char *file, int line, const int level, const int msgle= vel, + const char *file, int line, const int level, const msglvl_t = msglevel, const unsigned int permission_mask, unsigned int *option_typ= es_found, struct env_set *es, unsigned int *update_options_found) { @@ -6169,12 +6173,12 @@ static void add_option(struct options *options, char *p[], bool is_inline, const char = *file, int line, - const int level, const int msglevel, const unsigned int permiss= ion_mask, + const int level, const msglvl_t msglevel, const unsigned int pe= rmission_mask, unsigned int *option_types_found, struct env_set *es) { struct gc_arena gc =3D gc_new(); const bool pull_mode =3D BOOL_CAST(permission_mask & OPT_P_PULL_MODE); - int msglevel_fc =3D msglevel_forward_compatible(options, msglevel); + msglvl_t msglevel_fc =3D msglevel_forward_compatible(options, msglevel= ); ASSERT(MAX_PARMS >=3D 7); @@ -9869,7 +9873,7 @@ else { int i; - int msglevel_unknown =3D msglevel_fc; + msglvl_t msglevel_unknown =3D msglevel_fc; /* Check if an option is in --ignore-unknown-option and * set warning level to non fatal */ for (i =3D 0; options->ignore_unknown_option && options->ignore_un= known_option[i]; i++) diff --git a/src/openvpn/options.h b/src/openvpn/options.h index bb2c052..a737711 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -822,7 +822,7 @@ struct pull_filter *tail; }; -void parse_argv(struct options *options, const int argc, char *argv[], con= st int msglevel, +void parse_argv(struct options *options, const int argc, char *argv[], con= st msglvl_t msglevel, const unsigned int permission_mask, unsigned int *option_t= ypes_found, struct env_set *es); @@ -888,7 +888,7 @@ void options_detach(struct options *o); -void options_server_import(struct options *o, const char *filename, int ms= glevel, +void options_server_import(struct options *o, const char *filename, msglvl= _t msglevel, unsigned int permission_mask, unsigned int *opt= ion_types_found, struct env_set *es); @@ -897,13 +897,13 @@ void rol_check_alloc(struct options *options); int parse_line(const char *line, char *p[], const int n, const char *file,= const int line_num, - int msglevel, struct gc_arena *gc); + msglvl_t msglevel, struct gc_arena *gc); /* * parse/print topology coding */ -int parse_topology(const char *str, const int msglevel); +int parse_topology(const char *str, const msglvl_t msglevel); const char *print_topology(const int topology); @@ -917,11 +917,11 @@ int auth_retry_get(void); -bool auth_retry_set(const int msglevel, const char *option); +bool auth_retry_set(const msglvl_t msglevel, const char *option); const char *auth_retry_print(void); -void options_string_import(struct options *options, const char *config, co= nst int msglevel, +void options_string_import(struct options *options, const char *config, co= nst msglvl_t msglevel, const unsigned int permission_mask, unsigned in= t *option_types_found, struct env_set *es); diff --git a/src/openvpn/options_util.c b/src/openvpn/options_util.c index 5740ee5..cb4229e 100644 --- a/src/openvpn/options_util.c +++ b/src/openvpn/options_util.c @@ -117,7 +117,7 @@ } int -positive_atoi(const char *str, int msglevel) +positive_atoi(const char *str, msglvl_t msglevel) { char *endptr; long long i =3D strtoll(str, &endptr, 10); @@ -132,7 +132,7 @@ } bool -positive_atoll(const char *str, int64_t *value, const char *name, int msgl= evel) +positive_atoll(const char *str, int64_t *value, const char *name, msglvl_t= msglevel) { char *endptr; long long ll =3D strtoll(str, &endptr, 10); @@ -148,7 +148,7 @@ } int -atoi_warn(const char *str, int msglevel) +atoi_warn(const char *str, msglvl_t msglevel) { char *endptr; long long i =3D strtoll(str, &endptr, 10); @@ -163,7 +163,7 @@ } bool -atoi_constrained(const char *str, int *value, const char *name, int min, i= nt max, int msglevel) +atoi_constrained(const char *str, int *value, const char *name, int min, i= nt max, msglvl_t msglevel) { ASSERT(min < max); diff --git a/src/openvpn/options_util.h b/src/openvpn/options_util.h index 45417d9..1492eef 100644 --- a/src/openvpn/options_util.h +++ b/src/openvpn/options_util.h @@ -37,7 +37,7 @@ * Converts a str to a positive number if the string represents a postive * integer number. Otherwise print a warning with msglevel and return 0 */ -int positive_atoi(const char *str, int msglevel); +int positive_atoi(const char *str, msglvl_t msglevel); /** * Converts a str to an integer if the string can be represented as an @@ -48,13 +48,13 @@ * * @return \c true if the integer has been parsed and stored in value, \c = false otherwise */ -bool positive_atoll(const char *str, int64_t *value, const char *name, int= msglevel); +bool positive_atoll(const char *str, int64_t *value, const char *name, msg= lvl_t msglevel); /** * Converts a str to an integer if the string can be represented as an * integer number. Otherwise print a warning with \p msglevel and return 0 */ -int atoi_warn(const char *str, int msglevel); +int atoi_warn(const char *str, msglvl_t msglevel); /** * Converts a str to an integer if the string can be represented as an @@ -66,7 +66,7 @@ * @return \c true if the integer has been parsed and stored in value, \c = false otherwise */ bool atoi_constrained(const char *str, int *value, const char *name, int m= in, int max, - int msglevel); + msglvl_t msglevel); /** * Filter an option line by all pull filters. diff --git a/src/openvpn/packet_id.c b/src/openvpn/packet_id.c index 09696db..ca318eb 100644 --- a/src/openvpn/packet_id.c +++ b/src/openvpn/packet_id.c @@ -53,15 +53,15 @@ #define SEQ_EXPIRED ((time_t)1) #ifdef ENABLE_DEBUG -static void packet_id_debug_print(int msglevel, const struct packet_id_rec= *p, +static void packet_id_debug_print(msglvl_t msglevel, const struct packet_i= d_rec *p, const struct packet_id_net *pin, const c= har *message, packet_id_print_type value); #endif /* ENABLE_DEBUG */ static inline void -packet_id_debug(int msglevel, const struct packet_id_rec *p, const struct = packet_id_net *pin, - const char *message, uint64_t value) +packet_id_debug(msglvl_t msglevel, const struct packet_id_rec *p, + const struct packet_id_net *pin, const char *message, uint= 64_t value) { #ifdef ENABLE_DEBUG if (unlikely(check_debug_level(msglevel))) @@ -573,7 +573,8 @@ #ifdef ENABLE_DEBUG static void -packet_id_debug_print(int msglevel, const struct packet_id_rec *p, const s= truct packet_id_net *pin, +packet_id_debug_print(msglvl_t msglevel, const struct packet_id_rec *p, + const struct packet_id_net *pin, const char *message, packet_id_print_type value) { struct gc_arena gc =3D gc_new(); diff --git a/src/openvpn/pkcs11.c b/src/openvpn/pkcs11.c index dfc87f6..8a7a320 100644 --- a/src/openvpn/pkcs11.c +++ b/src/openvpn/pkcs11.c @@ -72,10 +72,10 @@ #endif }; -static unsigned +static msglvl_t _pkcs11_msg_pkcs112openvpn(const unsigned flags) { - unsigned openvpn_flags; + msglvl_t openvpn_flags; switch (flags) { @@ -112,7 +112,7 @@ } static unsigned -_pkcs11_msg_openvpn2pkcs11(const unsigned flags) +_pkcs11_msg_openvpn2pkcs11(const msglvl_t flags) { unsigned pkcs11_flags; diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c index ea76a08..a105058 100644 --- a/src/openvpn/plugin.c +++ b/src/openvpn/plugin.c @@ -50,7 +50,7 @@ static struct plugin_common *static_plugin_common =3D NULL; /* GLOBAL */ static void -plugin_show_string_array(int msglevel, const char *name, const char *array= []) +plugin_show_string_array(msglvl_t msglevel, const char *name, const char *= array[]) { int i; for (i =3D 0; array[i]; ++i) @@ -63,7 +63,7 @@ } static void -plugin_show_args_env(int msglevel, const char *argv[], const char *envp[]) +plugin_show_args_env(msglvl_t msglevel, const char *argv[], const char *en= vp[]) { if (check_debug_level(msglevel)) { @@ -184,7 +184,7 @@ #ifndef ENABLE_SMALL void -plugin_option_list_print(const struct plugin_option_list *list, int msglev= el) +plugin_option_list_print(const struct plugin_option_list *list, msglvl_t m= sglevel) { int i; struct gc_arena gc =3D gc_new(); @@ -995,7 +995,7 @@ #ifdef ENABLE_DEBUG void -plugin_return_print(const int msglevel, const char *prefix, const struct p= lugin_return *pr) +plugin_return_print(const msglvl_t msglevel, const char *prefix, const str= uct plugin_return *pr) { int i; msg(msglevel, "PLUGIN_RETURN_PRINT %s", prefix); diff --git a/src/openvpn/plugin.h b/src/openvpn/plugin.h index 63999b6..81d3739 100644 --- a/src/openvpn/plugin.h +++ b/src/openvpn/plugin.h @@ -111,7 +111,7 @@ bool plugin_option_list_add(struct plugin_option_list *list, char **p, str= uct gc_arena *gc); #ifndef ENABLE_SMALL -void plugin_option_list_print(const struct plugin_option_list *list, int m= sglevel); +void plugin_option_list_print(const struct plugin_option_list *list, msglv= l_t msglevel); #endif @@ -136,7 +136,7 @@ void plugin_return_free(struct plugin_return *pr); #ifdef ENABLE_DEBUG -void plugin_return_print(const int msglevel, const char *prefix, const str= uct plugin_return *pr); +void plugin_return_print(const msglvl_t msglevel, const char *prefix, cons= t struct plugin_return *pr); #endif diff --git a/src/openvpn/pool.c b/src/openvpn/pool.c index fde6cea..28ddd2c 100644 --- a/src/openvpn/pool.c +++ b/src/openvpn/pool.c @@ -114,7 +114,7 @@ * Verify start/end range */ bool -ifconfig_pool_verify_range(const int msglevel, const in_addr_t start, cons= t in_addr_t end) +ifconfig_pool_verify_range(const msglvl_t msglevel, const in_addr_t start,= const in_addr_t end) { struct gc_arena gc =3D gc_new(); bool ret =3D true; diff --git a/src/openvpn/pool.h b/src/openvpn/pool.h index 6cecef0..36e9fca 100644 --- a/src/openvpn/pool.h +++ b/src/openvpn/pool.h @@ -78,7 +78,7 @@ void ifconfig_pool_free(struct ifconfig_pool *pool); -bool ifconfig_pool_verify_range(const int msglevel, const in_addr_t start,= const in_addr_t end); +bool ifconfig_pool_verify_range(const msglvl_t msglevel, const in_addr_t s= tart, const in_addr_t end); =20 ifconfig_pool_handle ifconfig_pool_acquire(struct ifconfig_pool *pool, in_= addr_t *local, in_addr_t *remote, struct in6_a= ddr *remote_ipv6, diff --git a/src/openvpn/proto.c b/src/openvpn/proto.c index 34b3378..ab77887 100644 --- a/src/openvpn/proto.c +++ b/src/openvpn/proto.c @@ -183,7 +183,7 @@ int hlen; int totlen; const char *msgstr =3D "PACKET SIZE INFO"; - unsigned int msglevel =3D D_PACKET_TRUNC_DEBUG; + msglvl_t msglevel =3D D_PACKET_TRUNC_DEBUG; if (BLEN(&buf) < (int)sizeof(struct openvpn_iphdr)) { diff --git a/src/openvpn/push.c b/src/openvpn/push.c index 1ea7ed9..60ca25f 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -373,8 +373,8 @@ * * @return true on success, false on failure. */ -static bool push_option_fmt(struct gc_arena *gc, struct push_list *push_li= st, int msglevel, - const char *fmt, ...) +static bool push_option_fmt(struct gc_arena *gc, struct push_list *push_li= st, + msglvl_t msglevel, const char *fmt, ...) #ifdef __GNUC__ #if __USE_MINGW_ANSI_STDIO __attribute__((format(gnu_printf, 4, 5))) @@ -853,7 +853,7 @@ static void push_option_ex(struct gc_arena *gc, struct push_list *push_list, const cha= r *opt, bool enable, - int msglevel) + msglvl_t msglevel) { if (!string_class(opt, CC_ANY, CC_COMMA)) { @@ -881,7 +881,7 @@ } void -push_option(struct options *o, const char *opt, int msglevel) +push_option(struct options *o, const char *opt, msglvl_t msglevel) { push_option_ex(&o->gc, &o->push_list, opt, true, msglevel); } @@ -902,7 +902,7 @@ } void -push_options(struct options *o, char **p, int msglevel, struct gc_arena *g= c) +push_options(struct options *o, char **p, msglvl_t msglevel, struct gc_are= na *gc) { const char **argv =3D make_extended_arg_array(p, false, gc); char *opt =3D print_argv(argv, gc, 0); @@ -910,8 +910,8 @@ } static bool -push_option_fmt(struct gc_arena *gc, struct push_list *push_list, int msgl= evel, const char *format, - ...) +push_option_fmt(struct gc_arena *gc, struct push_list *push_list, + msglvl_t msglevel, const char *format, ...) { va_list arglist; char tmp[256] =3D { 0 }; diff --git a/src/openvpn/push.h b/src/openvpn/push.h index 8ffd0c2..6b3275e 100644 --- a/src/openvpn/push.h +++ b/src/openvpn/push.h @@ -99,9 +99,9 @@ void clone_push_list(struct options *o); -void push_option(struct options *o, const char *opt, int msglevel); +void push_option(struct options *o, const char *opt, msglvl_t msglevel); -void push_options(struct options *o, char **p, int msglevel, struct gc_are= na *gc); +void push_options(struct options *o, char **p, msglvl_t msglevel, struct g= c_arena *gc); void push_reset(struct options *o); diff --git a/src/openvpn/route.c b/src/openvpn/route.c index e504485..aa5ce69 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -1228,28 +1228,28 @@ } static void -print_route_option(const struct route_option *ro, int level) +print_route_option(const struct route_option *ro, msglvl_t msglevel) { - msg(level, " route %s/%s/%s/%s", show_opt(ro->network), show_opt(ro->= netmask), + msg(msglevel, " route %s/%s/%s/%s", show_opt(ro->network), show_opt(r= o->netmask), show_opt(ro->gateway), show_opt(ro->metric)); } void -print_route_options(const struct route_option_list *rol, int level) +print_route_options(const struct route_option_list *rol, msglvl_t msglevel) { struct route_option *ro; if (rol->flags & RG_ENABLE) { - msg(level, " [redirect_default_gateway local=3D%d]", (rol->flags = & RG_LOCAL) !=3D 0); + msg(msglevel, " [redirect_default_gateway local=3D%d]", (rol->fla= gs & RG_LOCAL) !=3D 0); } for (ro =3D rol->routes; ro; ro =3D ro->next) { - print_route_option(ro, level); + print_route_option(ro, msglevel); } } void -print_default_gateway(const int msglevel, const struct route_gateway_info = *rgi, +print_default_gateway(const msglvl_t msglevel, const struct route_gateway_= info *rgi, const struct route_ipv6_gateway_info *rgi6) { struct gc_arena gc =3D gc_new(); @@ -1323,23 +1323,23 @@ #endif /* ifndef ENABLE_SMALL */ static void -print_route(const struct route_ipv4 *r, int level) +print_route(const struct route_ipv4 *r, msglvl_t msglevel) { struct gc_arena gc =3D gc_new(); if (r->flags & RT_DEFINED) { - msg(level, "%s", route_string(r, &gc)); + msg(msglevel, "%s", route_string(r, &gc)); } gc_free(&gc); } void -print_routes(const struct route_list *rl, int level) +print_routes(const struct route_list *rl, msglvl_t msglevel) { struct route_ipv4 *r; for (r =3D rl->routes; r; r =3D r->next) { - print_route(r, level); + print_route(r, msglevel); } } @@ -3059,18 +3059,18 @@ * Show current routing table */ void -show_routes(int msglev) +show_routes(msglvl_t msglevel) { struct gc_arena gc =3D gc_new(); const MIB_IPFORWARDTABLE *rt =3D get_windows_routing_table(&gc); - msg(msglev, "SYSTEM ROUTING TABLE"); + msg(msglevel, "SYSTEM ROUTING TABLE"); if (rt) { for (DWORD i =3D 0; i < rt->dwNumEntries; ++i) { - msg(msglev, "%s", format_route_entry(&rt->table[i], &gc)); + msg(msglevel, "%s", format_route_entry(&rt->table[i], &gc)); } } gc_free(&gc); diff --git a/src/openvpn/route.h b/src/openvpn/route.h index 9b6a47e..c5006ae 100644 --- a/src/openvpn/route.h +++ b/src/openvpn/route.h @@ -356,7 +356,7 @@ void get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi, const s= truct in6_addr *dest, openvpn_net_ctx_t *ctx); -void print_default_gateway(const int msglevel, const struct route_gateway_= info *rgi, +void print_default_gateway(const msglvl_t msglevel, const struct route_gat= eway_info *rgi, const struct route_ipv6_gateway_info *rgi6); /* @@ -371,15 +371,15 @@ int test_local_addr(const in_addr_t addr, const struct route_gateway_info = *rgi); #ifndef ENABLE_SMALL -void print_route_options(const struct route_option_list *rol, int level); +void print_route_options(const struct route_option_list *rol, msglvl_t msg= level); #endif -void print_routes(const struct route_list *rl, int level); +void print_routes(const struct route_list *rl, msglvl_t msglevel); #ifdef _WIN32 -void show_routes(int msglev); +void show_routes(msglvl_t msglevel); bool test_routes(const struct route_list *rl, const struct tuntap *tt); diff --git a/src/openvpn/run_command.c b/src/openvpn/run_command.c index 4a1ef22..a0c9484 100644 --- a/src/openvpn/run_command.c +++ b/src/openvpn/run_command.c @@ -107,7 +107,7 @@ #ifndef WIN32 bool -openvpn_waitpid_check(pid_t pid, const char *msg_prefix, int msglevel) +openvpn_waitpid_check(pid_t pid, const char *msg_prefix, msglvl_t msglevel) { if (pid =3D=3D 0) { diff --git a/src/openvpn/run_command.h b/src/openvpn/run_command.h index afd1b88..234055e 100644 --- a/src/openvpn/run_command.h +++ b/src/openvpn/run_command.h @@ -71,13 +71,13 @@ * This function is currently not implemented for Windows as the helper * macros used by this function are not available. * - * @param pid pid of the process to be checked + * @param pid pid of the process to be checked * @param msg_prefix prefixed of the message that be printed - * @param msglevel msglevel of the messages to be printed - * @return true if the process is still running, false if - * an error condition occurred + * @param msglevel msglevel of the messages to be printed + * @return true if the process is still running, false if + * an error condition occurred */ -bool openvpn_waitpid_check(pid_t pid, const char *msg_prefix, int msglevel= ); +bool openvpn_waitpid_check(pid_t pid, const char *msg_prefix, msglvl_t msg= level); #endif diff --git a/src/openvpn/sig.c b/src/openvpn/sig.c index ecea635..42ad823 100644 --- a/src/openvpn/sig.c +++ b/src/openvpn/sig.c @@ -287,7 +287,7 @@ } void -print_signal(const struct signal_info *si, const char *title, int msglevel) +print_signal(const struct signal_info *si, const char *title, msglvl_t msg= level) { if (si) { diff --git a/src/openvpn/sig.h b/src/openvpn/sig.h index 7e5dd9f..b5d81fc 100644 --- a/src/openvpn/sig.h +++ b/src/openvpn/sig.h @@ -66,7 +66,7 @@ void restore_signal_state(void); -void print_signal(const struct signal_info *si, const char *title, int msg= level); +void print_signal(const struct signal_info *si, const char *title, msglvl_= t msglevel); void print_status(struct context *c, struct status_output *so); diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 306170c..eeb42d1 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -78,7 +78,7 @@ static int get_addr_generic(sa_family_t af, unsigned int flags, const char *hostname,= void *network, unsigned int *netbits, int resolve_retry_seconds, struct = signal_info *sig_info, - int msglevel) + msglvl_t msglevel) { char *endp, *sep, *var_host =3D NULL; struct addrinfo *ai =3D NULL; @@ -211,7 +211,8 @@ } bool -get_ipv6_addr(const char *hostname, struct in6_addr *network, unsigned int= *netbits, int msglevel) +get_ipv6_addr(const char *hostname, struct in6_addr *network, unsigned int= *netbits, + msglvl_t msglevel) { if (get_addr_generic(AF_INET6, GETADDR_RESOLVE, hostname, network, net= bits, 0, NULL, msglevel) < 0) @@ -1516,7 +1517,7 @@ linksock_print_addr(struct link_socket *sock) { struct gc_arena gc =3D gc_new(); - const int msglevel =3D (sock->mode =3D=3D LS_MODE_TCP_ACCEPT_FROM) ? D= _INIT_MEDIUM : M_INFO; + const msglvl_t msglevel =3D (sock->mode =3D=3D LS_MODE_TCP_ACCEPT_FROM= ) ? D_INIT_MEDIUM : M_INFO; /* print local address */ if (sock->bind_local) diff --git a/src/openvpn/socket_util.c b/src/openvpn/socket_util.c index 9b7312d..fa566e7 100644 --- a/src/openvpn/socket_util.c +++ b/src/openvpn/socket_util.c @@ -541,7 +541,7 @@ struct addrinfo hints; int status; struct signal_info sigrec =3D { 0 }; - int msglevel =3D (flags & GETADDR_FATAL) ? M_FATAL : D_RESOLVE_ERRORS; + msglvl_t msglevel =3D (flags & GETADDR_FATAL) ? M_FATAL : D_RESOLVE_ER= RORS; struct gc_arena gc =3D gc_new(); const char *print_hostname; const char *print_servname; @@ -604,7 +604,7 @@ int resolve_retries =3D (flags & GETADDR_TRY_ONCE) ? 1 : ((resolve_retry_seconds + 4) = / fail_wait_interval); const char *fmt; - int level =3D 0; + msglvl_t level =3D 0; /* this is not a numeric IP, therefore force resolution using the * provided ai_family */ @@ -739,7 +739,7 @@ done: if (sig_info && sig_info->signal_received) { - int level =3D 0; + msglvl_t level =3D 0; if (flags & GETADDR_FATAL_ON_SIGNAL) { level =3D M_FATAL; diff --git a/src/openvpn/socket_util.h b/src/openvpn/socket_util.h index 361edff..ada52a4 100644 --- a/src/openvpn/socket_util.h +++ b/src/openvpn/socket_util.h @@ -142,7 +142,7 @@ * Translate an IPv6 addr or hostname from string form to in6_addr */ bool get_ipv6_addr(const char *hostname, struct in6_addr *network, unsigne= d int *netbits, - int msglevel); + msglvl_t msglevel); int openvpn_getaddrinfo(unsigned int flags, const char *hostname, const ch= ar *servname, int resolve_retry_seconds, struct signal_info *sig= _info, int ai_family, diff --git a/src/openvpn/ssl_verify_backend.h b/src/openvpn/ssl_verify_back= end.h index a0559c9..2bad3eb 100644 --- a/src/openvpn/ssl_verify_backend.h +++ b/src/openvpn/ssl_verify_backend.h @@ -193,8 +193,8 @@ * @param gc Garbage collection arena for temp data * */ -void x509_track_add(const struct x509_track **ll_head, const char *name, i= nt msglevel, - struct gc_arena *gc); +void x509_track_add(const struct x509_track **ll_head, const char *name, + msglvl_t msglevel, struct gc_arena *gc); /* * Save X509 fields to environment, using the naming convention: diff --git a/src/openvpn/ssl_verify_mbedtls.c b/src/openvpn/ssl_verify_mbed= tls.c index cfcfb25..3588071 100644 --- a/src/openvpn/ssl_verify_mbedtls.c +++ b/src/openvpn/ssl_verify_mbedtls.c @@ -350,7 +350,7 @@ } void -x509_track_add(const struct x509_track **ll_head, const char *name, int ms= glevel, +x509_track_add(const struct x509_track **ll_head, const char *name, msglvl= _t msglevel, struct gc_arena *gc) { struct x509_track *xt; diff --git a/src/openvpn/ssl_verify_openssl.c b/src/openvpn/ssl_verify_open= ssl.c index 6de7e2a..0f257e2 100644 --- a/src/openvpn/ssl_verify_openssl.c +++ b/src/openvpn/ssl_verify_openssl.c @@ -414,7 +414,7 @@ */ void -x509_track_add(const struct x509_track **ll_head, const char *name, int ms= glevel, +x509_track_add(const struct x509_track **ll_head, const char *name, msglvl= _t msglevel, struct gc_arena *gc) { struct x509_track *xt; diff --git a/src/openvpn/status.c b/src/openvpn/status.c index 34e5a2f..cea31f5 100644 --- a/src/openvpn/status.c +++ b/src/openvpn/status.c @@ -230,14 +230,13 @@ if (so->msglevel >=3D 0 && !so->errors) { - msg(so->msglevel, "%s", buf); + msg((msglvl_t)so->msglevel, "%s", buf); } if (so->fd >=3D 0 && !so->errors) { - int len; strcat(buf, "\n"); - len =3D strlen(buf); + size_t len =3D strlen(buf); if (len > 0) { if (write(so->fd, buf, len) !=3D len) diff --git a/src/openvpn/status.h b/src/openvpn/status.h index 0c7a869..25e1663 100644 --- a/src/openvpn/status.h +++ b/src/openvpn/status.h @@ -53,6 +53,7 @@ char *filename; int fd; + /* NB: -1 is used to indicate that output should only go to the file */ int msglevel; const struct virtual_output *vout; diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index ee0733a..9618301 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -105,9 +105,9 @@ static void netsh_set_dns6_servers(const struct in6_addr *addr_list, const= int addr_len, DWORD adapter_index); -static void netsh_command(const struct argv *a, int n, int msglevel); +static void netsh_command(const struct argv *a, int n, msglvl_t msglevel); -static void exec_command(const char *prefix, const struct argv *a, int n, = int msglevel); +static void exec_command(const char *prefix, const struct argv *a, int n, = msglvl_t msglevel); static const char *netsh_get_id(const char *dev_node, struct gc_arena *gc); @@ -4001,7 +4001,7 @@ } void -show_tap_win_adapters(int msglev, int warnlev) +show_tap_win_adapters(msglvl_t msglevel, msglvl_t warnlevel) { struct gc_arena gc =3D gc_new(); @@ -4018,7 +4018,7 @@ const struct tap_reg *tap_reg =3D get_tap_reg(&gc); const struct panel_reg *panel_reg =3D get_panel_reg(&gc); - msg(msglev, "Available adapters [name, GUID, driver]:"); + msg(msglevel, "Available adapters [name, GUID, driver]:"); /* loop through each TAP-Windows adapter registry entry */ for (tr =3D tap_reg; tr !=3D NULL; tr =3D tr->next) @@ -4030,7 +4030,7 @@ { if (!strcmp(tr->guid, pr->guid)) { - msg(msglev, "'%s' %s %s", pr->name, tr->guid, + msg(msglevel, "'%s' %s %s", pr->name, tr->guid, print_tun_backend_driver(tr->windows_driver)); ++links; } @@ -4045,7 +4045,7 @@ /* a TAP adapter exists without a link from the network * connections control panel */ warn_panel_null =3D true; - msg(msglev, "[NULL] %s", tr->guid); + msg(msglevel, "[NULL] %s", tr->guid); } } @@ -4064,18 +4064,18 @@ /* warn on registry inconsistencies */ if (warn_tap_dup) { - msg(warnlev, "WARNING: Some TAP-Windows adapters have duplicate GU= IDs"); + msg(warnlevel, "WARNING: Some TAP-Windows adapters have duplicate = GUIDs"); } if (warn_panel_dup) { - msg(warnlev, + msg(warnlevel, "WARNING: Some TAP-Windows adapters have duplicate links from = the Network Connections control panel"); } if (warn_panel_null) { - msg(warnlev, + msg(warnlevel, "WARNING: Some TAP-Windows adapters have no link from the Netw= ork Connections control panel"); } @@ -4805,31 +4805,31 @@ * Show info for a single adapter */ static void -show_adapter(int msglev, const IP_ADAPTER_INFO *a, struct gc_arena *gc) +show_adapter(msglvl_t msglevel, const IP_ADAPTER_INFO *a, struct gc_arena = *gc) { - msg(msglev, "%s", a->Description); - msg(msglev, " Index =3D %d", (int)a->Index); - msg(msglev, " GUID =3D %s", a->AdapterName); - msg(msglev, " IP =3D %s", format_ip_addr_string(&a->IpAddressList, gc= )); - msg(msglev, " MAC =3D %s", format_hex_ex(a->Address, a->AddressLength= , 0, 1, ":", gc)); - msg(msglev, " GATEWAY =3D %s", format_ip_addr_string(&a->GatewayList,= gc)); + msg(msglevel, "%s", a->Description); + msg(msglevel, " Index =3D %d", (int)a->Index); + msg(msglevel, " GUID =3D %s", a->AdapterName); + msg(msglevel, " IP =3D %s", format_ip_addr_string(&a->IpAddressList, = gc)); + msg(msglevel, " MAC =3D %s", format_hex_ex(a->Address, a->AddressLeng= th, 0, 1, ":", gc)); + msg(msglevel, " GATEWAY =3D %s", format_ip_addr_string(&a->GatewayLis= t, gc)); if (a->DhcpEnabled) { - msg(msglev, " DHCP SERV =3D %s", format_ip_addr_string(&a->DhcpSe= rver, gc)); - msg(msglev, " DHCP LEASE OBTAINED =3D %s", time_string(a->LeaseOb= tained, 0, false, gc)); - msg(msglev, " DHCP LEASE EXPIRES =3D %s", time_string(a->LeaseEx= pires, 0, false, gc)); + msg(msglevel, " DHCP SERV =3D %s", format_ip_addr_string(&a->Dhcp= Server, gc)); + msg(msglevel, " DHCP LEASE OBTAINED =3D %s", time_string(a->Lease= Obtained, 0, false, gc)); + msg(msglevel, " DHCP LEASE EXPIRES =3D %s", time_string(a->Lease= Expires, 0, false, gc)); } if (a->HaveWins) { - msg(msglev, " PRI WINS =3D %s", format_ip_addr_string(&a->Primary= WinsServer, gc)); - msg(msglev, " SEC WINS =3D %s", format_ip_addr_string(&a->Seconda= ryWinsServer, gc)); + msg(msglevel, " PRI WINS =3D %s", format_ip_addr_string(&a->Prima= ryWinsServer, gc)); + msg(msglevel, " SEC WINS =3D %s", format_ip_addr_string(&a->Secon= daryWinsServer, gc)); } { const IP_PER_ADAPTER_INFO *pai =3D get_per_adapter_info(a->Index, = gc); if (pai) { - msg(msglev, " DNS SERV =3D %s", format_ip_addr_string(&pai->D= nsServerList, gc)); + msg(msglevel, " DNS SERV =3D %s", format_ip_addr_string(&pai-= >DnsServerList, gc)); } } } @@ -4838,12 +4838,12 @@ * Show current adapter list */ void -show_adapters(int msglev) +show_adapters(msglvl_t msglevel) { struct gc_arena gc =3D gc_new(); const IP_ADAPTER_INFO *ai =3D get_adapter_info_list(&gc); - msg(msglev, "SYSTEM ADAPTER LIST"); + msg(msglevel, "SYSTEM ADAPTER LIST"); if (ai) { const IP_ADAPTER_INFO *a; @@ -4851,7 +4851,7 @@ /* find index in the linked list */ for (a =3D ai; a !=3D NULL; a =3D a->Next) { - show_adapter(msglev, a, &gc); + show_adapter(msglevel, a, &gc); } } gc_free(&gc); @@ -5048,7 +5048,7 @@ } static void -exec_command(const char *prefix, const struct argv *a, int n, int msglevel) +exec_command(const char *prefix, const struct argv *a, int n, msglvl_t msg= level) { int i; for (i =3D 0; i < n; ++i) @@ -5069,7 +5069,7 @@ } static void -netsh_command(const struct argv *a, int n, int msglevel) +netsh_command(const struct argv *a, int n, msglvl_t msglevel) { exec_command("NETSH", a, n, msglevel); } diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h index 06fc729..6562c22 100644 --- a/src/openvpn/tun.h +++ b/src/openvpn/tun.h @@ -445,9 +445,9 @@ DWORD adapter_index_of_ip(const IP_ADAPTER_INFO *list, const in_addr_t ip,= int *count, in_addr_t *netmask); -void show_tap_win_adapters(int msglev, int warnlev); +void show_tap_win_adapters(msglvl_t msglevel, msglvl_t warnlevel); -void show_adapters(int msglev); +void show_adapters(msglvl_t msglevel); void tap_allow_nonadmin_access(const char *dev_node); diff --git a/tests/unit_tests/openvpn/mock_msg.c b/tests/unit_tests/openvpn= /mock_msg.c index 603520b..69d2d1d 100644 --- a/tests/unit_tests/openvpn/mock_msg.c +++ b/tests/unit_tests/openvpn/mock_msg.c @@ -38,8 +38,8 @@ #include "error.h" #include "mock_msg.h" -unsigned int x_debug_level =3D 0; /* Default to (almost) no debugging outp= ut */ -unsigned int print_x_debug_level =3D 0; +msglvl_t x_debug_level =3D 0; /* Default to (almost) no debugging output */ +msglvl_t print_x_debug_level =3D 0; bool fatal_error_triggered =3D false; @@ -47,31 +47,31 @@ void -mock_set_debug_level(int level) +mock_set_debug_level(msglvl_t level) { x_debug_level =3D level; } -int +msglvl_t mock_get_debug_level(void) { return x_debug_level; } void -mock_set_print_debug_level(int level) +mock_set_print_debug_level(msglvl_t level) { print_x_debug_level =3D level; } -int +msglvl_t get_debug_level(void) { return x_debug_level; } void -x_msg_va(const unsigned int flags, const char *format, va_list arglist) +x_msg_va(const msglvl_t flags, const char *format, va_list arglist) { if (flags & M_FATAL) { @@ -89,7 +89,7 @@ } void -x_msg(const unsigned int flags, const char *format, ...) +x_msg(const msglvl_t flags, const char *format, ...) { va_list arglist; va_start(arglist, format); @@ -128,7 +128,7 @@ } bool -dont_mute(unsigned int flags) +dont_mute(msglvl_t flags) { return true; } diff --git a/tests/unit_tests/openvpn/mock_msg.h b/tests/unit_tests/openvpn= /mock_msg.h index f4ebc23..6dddf0b 100644 --- a/tests/unit_tests/openvpn/mock_msg.h +++ b/tests/unit_tests/openvpn/mock_msg.h @@ -28,17 +28,15 @@ * this function from your test driver to increase debug output when you * need debug output. */ -void mock_set_debug_level(int level); +void mock_set_debug_level(msglvl_t level); #define MOCK_MSG_BUF 2048 extern bool fatal_error_triggered; extern char mock_msg_buf[MOCK_MSG_BUF]; -void mock_set_debug_level(int level); +msglvl_t mock_get_debug_level(void); -int mock_get_debug_level(void); - -void mock_set_print_debug_level(int level); +void mock_set_print_debug_level(msglvl_t level); #endif /* MOCK_MSG */ diff --git a/tests/unit_tests/openvpn/mock_ssl_dependencies.c b/tests/unit_= tests/openvpn/mock_ssl_dependencies.c index 7333c47..f2fa93a 100644 --- a/tests/unit_tests/openvpn/mock_ssl_dependencies.c +++ b/tests/unit_tests/openvpn/mock_ssl_dependencies.c @@ -38,7 +38,7 @@ int parse_line(const char *line, char **p, const int n, const char *file, cons= t int line_num, - int msglevel, struct gc_arena *gc) + msglvl_t msglevel, struct gc_arena *gc) { /* Dummy function to get the linker happy, should never be called */ assert_true(false); diff --git a/tests/unit_tests/openvpn/test_argv.c b/tests/unit_tests/openvp= n/test_argv.c index a65857b..a04fabc 100644 --- a/tests/unit_tests/openvpn/test_argv.c +++ b/tests/unit_tests/openvpn/test_argv.c @@ -23,7 +23,7 @@ int __wrap_parse_line(const char *line, char **p, const int n, const char *fil= e, const int line_num, - int msglevel, struct gc_arena *gc) + msglvl_t msglevel, struct gc_arena *gc) { p[0] =3D PATH1 PATH2; p[1] =3D PARAM1; diff --git a/tests/unit_tests/openvpn/test_misc.c b/tests/unit_tests/openvp= n/test_misc.c index 93e2460..dbfdd56 100644 --- a/tests/unit_tests/openvpn/test_misc.c +++ b/tests/unit_tests/openvpn/test_misc.c @@ -339,8 +339,8 @@ assert_false(valid_integer("-2147483653", false)); - int msglevel =3D D_LOW; - int saved_log_level =3D mock_get_debug_level(); + msglvl_t msglevel =3D D_LOW; + msglvl_t saved_log_level =3D mock_get_debug_level(); mock_set_debug_level(D_LOW); /* check happy path */ diff --git a/tests/unit_tests/openvpn/test_pkcs11.c b/tests/unit_tests/open= vpn/test_pkcs11.c index 9ba6cfc..d568865 100644 --- a/tests/unit_tests/openvpn/test_pkcs11.c +++ b/tests/unit_tests/openvpn/test_pkcs11.c @@ -59,7 +59,7 @@ /* stubs for some unused functions instead of pulling in too many dependen= cies */ int parse_line(const char *line, char **p, const int n, const char *file, cons= t int line_num, - int msglevel, struct gc_arena *gc) + msglvl_t msglevel, struct gc_arena *gc) { assert_true(0); return 0; diff --git a/tests/unit_tests/openvpn/test_pkt.c b/tests/unit_tests/openvpn= /test_pkt.c index 5122766..b6c612b 100644 --- a/tests/unit_tests/openvpn/test_pkt.c +++ b/tests/unit_tests/openvpn/test_pkt.c @@ -45,7 +45,7 @@ int parse_line(const char *line, char **p, const int n, const char *file, cons= t int line_num, - int msglevel, struct gc_arena *gc) + msglvl_t msglevel, struct gc_arena *gc) { /* Dummy function to get the linker happy, should never be called */ assert_true(false); diff --git a/tests/unit_tests/openvpn/test_push_update_msg.c b/tests/unit_t= ests/openvpn/test_push_update_msg.c index 87329b1..8a5beeb 100644 --- a/tests/unit_tests/openvpn/test_push_update_msg.c +++ b/tests/unit_tests/openvpn/test_push_update_msg.c @@ -111,7 +111,7 @@ #ifndef ENABLE_MANAGEMENT bool -send_control_channel_string(struct context *c, const char *str, int msglev= el) +send_control_channel_string(struct context *c, const char *str, msglvl_t m= sglevel) { return true; } @@ -120,7 +120,7 @@ int i; bool -send_control_channel_string(struct context *c, const char *str, int msglev= el) +send_control_channel_string(struct context *c, const char *str, msglvl_t m= sglevel) { if (res && res[i] && strcmp(res[i], str)) { diff --git a/tests/unit_tests/openvpn/test_socket.c b/tests/unit_tests/open= vpn/test_socket.c index 2da2529..7f740ac 100644 --- a/tests/unit_tests/openvpn/test_socket.c +++ b/tests/unit_tests/openvpn/test_socket.c @@ -59,7 +59,7 @@ int parse_line(const char *line, char **p, const int n, const char *file, cons= t int line_num, - int msglevel, struct gc_arena *gc) + msglvl_t msglevel, struct gc_arena *gc) { assert_true(0); return 0; diff --git a/tests/unit_tests/openvpn/test_tls_crypt.c b/tests/unit_tests/o= penvpn/test_tls_crypt.c index 532bfcd..44d51fe 100644 --- a/tests/unit_tests/openvpn/test_tls_crypt.c +++ b/tests/unit_tests/openvpn/test_tls_crypt.c @@ -98,7 +98,7 @@ int __wrap_parse_line(const char *line, char **p, const int n, const char *fil= e, const int line_num, - int msglevel, struct gc_arena *gc) + msglvl_t msglevel, struct gc_arena *gc) { p[0] =3D PATH1 PATH2; p[1] =3D PARAM1; diff --git a/tests/unit_tests/openvpn/test_user_pass.c b/tests/unit_tests/o= penvpn/test_user_pass.c index 460b37f..32ec59f 100644 --- a/tests/unit_tests/openvpn/test_user_pass.c +++ b/tests/unit_tests/openvpn/test_user_pass.c @@ -73,7 +73,7 @@ /* stubs for some unused functions instead of pulling in too many dependen= cies */ int parse_line(const char *line, char **p, const int n, const char *file, cons= t int line_num, - int msglevel, struct gc_arena *gc) + msglvl_t msglevel, struct gc_arena *gc) { assert_true(0); return 0; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1110?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Id492cb774c6d022d06bb3cf5fec2a4bdd410e619 Gerrit-Change-Number: 1110 Gerrit-PatchSet: 17 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --1VllKtja4lk= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #17 to the change originally c= reated by flichtenheld.

View Change

The following approvals got out= dated and were removed: Code-Review+2 by cron2, Code-Review+2 by ordex

Introduce msglvl_t to unify =
msglevel type handling

msglevel was definitely unsigned as the first=
argument to msg(), but many parts of the code
had it as signed. So t= his produced a LOT of
warnings when enabling -Wsign-conversion.

I= ntroduce a msglvl_t typedef and switch all
users to it. This includes an= y values that
are stored in the msglevel field, including
debug level= and mute level.

There is one exception in struct status_output
w= here -1 is a valid value in the API. Only
positive values are translated= into standard
message levels.

Change-Id: Id492cb774c6d022d06bb3c= f5fec2a4bdd410e619
Signed-off-by: Frank Lichtenheld <frank@...2641...= >
Acked-by: Gert Doering <gert@...1296...>
Gerrit URL: https= ://gerrit.openvpn.net/c/openvpn/+/1110
Message-Id: <20250917170428.33= 10-1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn-devel= @lists.sourceforge.net/msg33028.html
Signed-off-by: Gert Doering <ger= t@...1296...>
---
M src/openvpn/argv.c
M src/openvpn/argv.h
= M src/openvpn/buffer.c
M src/openvpn/clinat.c
M src/openvpn/clinat.h<= br>M src/openvpn/comp.c
M src/openvpn/comp.h
M src/openvpn/crypto.cM src/openvpn/crypto.h
M src/openvpn/dco.c
M src/openvpn/dco.h
M= src/openvpn/dco_freebsd.c
M src/openvpn/dco_linux.c
M src/openvpn/dc= o_win.c
M src/openvpn/dns.c
M src/openvpn/dns.h
M src/openvpn/env_= set.c
M src/openvpn/env_set.h
M src/openvpn/error.c
M src/openvpn/= error.h
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/open= vpn/init.c
M src/openvpn/init.h
M src/openvpn/manage.c
M src/openv= pn/manage.h
M src/openvpn/mtu.c
M src/openvpn/mtu.h
M src/openvpn/= multi.c
M src/openvpn/options.c
M src/openvpn/options.h
M src/open= vpn/options_util.c
M src/openvpn/options_util.h
M src/openvpn/packet_= id.c
M src/openvpn/pkcs11.c
M src/openvpn/plugin.c
M src/openvpn/p= lugin.h
M src/openvpn/pool.c
M src/openvpn/pool.h
M src/openvpn/pr= oto.c
M src/openvpn/push.c
M src/openvpn/push.h
M src/openvpn/rout= e.c
M src/openvpn/route.h
M src/openvpn/run_command.c
M src/openvp= n/run_command.h
M src/openvpn/sig.c
M src/openvpn/sig.h
M src/open= vpn/socket.c
M src/openvpn/socket_util.c
M src/openvpn/socket_util.h<= br>M src/openvpn/ssl_verify_backend.h
M src/openvpn/ssl_verify_mbedtls.c=
M src/openvpn/ssl_verify_openssl.c
M src/openvpn/status.c
M src/o= penvpn/status.h
M src/openvpn/tun.c
M src/openvpn/tun.h
M tests/un= it_tests/openvpn/mock_msg.c
M tests/unit_tests/openvpn/mock_msg.h
M t= ests/unit_tests/openvpn/mock_ssl_dependencies.c
M tests/unit_tests/openv= pn/test_argv.c
M tests/unit_tests/openvpn/test_misc.c
M tests/unit_te= sts/openvpn/test_pkcs11.c
M tests/unit_tests/openvpn/test_pkt.c
M tes= ts/unit_tests/openvpn/test_push_update_msg.c
M tests/unit_tests/openvpn/= test_socket.c
M tests/unit_tests/openvpn/test_tls_crypt.c
M tests/uni= t_tests/openvpn/test_user_pass.c
69 files changed, 283 insertions(+), 27= 5 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn re=
fs/changes/10/1110/17
diff --git a/src/openvpn/argv.c b/src/openvpn=
/argv.c
index 903fc0a..79b541a 100644
--- a= /src/openvpn/argv.c
+++ b/src/openvpn/argv.c
@@ -235,14 +235,14 @@
/**
* Write the= arguments stored in a struct argv via the msg() command.
= *
- * @param msglev = Integer with the message level used by msg().
- * @param a Valid pointer to the struct argv= with the arguments to write.
+ * @param msglevel Integer with the message level used by msg()= .
+ * @param a = Valid pointer to the struct argv with the arguments to write.
= */
void
-argv_msg(const int msglev, const struct argv *a)
+argv_msg(const msglvl_t msglevel, c= onst struct argv *a)
{
struct gc_aren= a gc =3D gc_new();
- = msg(msglev, "%s", argv_str(a, &gc, 0));
+ msg(msglevel, "%s", argv_s= tr(a, &gc, 0));
gc_free(&gc);
= }

@@ -250,16 +250,16 @@
= * Similar to argv_msg() but prefixes the messages being written with a
* given string.
*
- * @param msglev Integer with the message= level used by msg().
-= * @param a Valid pointer to the struct argv with the arguments to w= rite
- * @param prefix= Valid pointer to the prefix string
+ * @param msglevel Integer with the message level used b= y msg().
+ * @param = a Valid pointer to the struct argv with the arguments to write

+ * @param prefix Val= id pointer to the prefix string
*
*/
void
-ar= gv_msg_prefix(const int msglev, const struct argv *a, const char *prefix)
+argv_msg_prefix(const= msglvl_t msglevel, const struct argv *a, const char *prefix)
{

struct gc_arena gc =3D gc_new();
- msg(msglev, "%s: %s", p= refix, argv_str(a, &gc, 0));

+ msg(msglevel, "%s: %s", prefix, argv_str(a, &= ;gc, 0));
gc_free(&gc);
}<= br>
diff --git a/src/openvpn/argv.h b/src/openvpn/ar= gv.h
index 056fe31..969d7b1 100644
--- a/sr= c/openvpn/argv.h
+++ b/src/openvpn/argv.h
@= @ -47,9 +47,9 @@

struct argv argv_insert= _head(const struct argv *a, const char *head);

= -void argv_msg(const int msglev, = const struct argv *a);
-void argv_msg_= prefix(const int msglev, const struct argv *a, const char *prefix);<= br>+void argv_msg_prefix(const = msglvl_t msglevel, const struct argv *a, const char *prefix);

void argv_parse_cmd(struct argv *a, const char *s);

diff --git a/src/openvpn/buffer.c b/src/op= envpn/buffer.c
index 0f0d17e..c0b85b2 100644
--- a/src/openvpn/buffer.c

+++ b/src/openvpn/buffer.c

@@ -1127,7 +1127,7 @@
{
= if (buf && buf->len)
{
- int msglevel =3D D_ALIGN_DEBUG;
+ msglvl_t msgle= vel =3D D_ALIGN_DEBUG;
const unsigned int u =3D (u= nsigned int)BPTR(buf);

if (u &am= p; (PAYLOAD_ALIGN - 1))
diff --git a/src/openvpn/clinat.c b= /src/openvpn/clinat.c
index 48a2057..b49d4bb 100644<= br>--- a/src/openvpn/clinat.c
+++ b/src/openvpn/clina= t.c
@@ -47,7 +47,7 @@
}
<= /span>
void
-= print_client_nat_list(const struct client_nat_option_list *list, int msglev= el)
+print_client_nat= _list(const struct client_nat_option_list *list, msglvl_t msglevel)<= br> {
struct gc_arena gc =3D gc_new(); int i;
@@ -101,7 +101,7 @@
voi= d
add_client_nat_to_option_list(struct client_nat_option_l= ist *dest, const char *type,
= const char *network, const char *netmask, const char *foreign_network,
- = int msglevel)
+ = msglvl_t msglevel)
{ struct client_nat_entry e;
bool ok;
@@ -159,7 +159,7 @@
#endif

static void
-print_pkt(struct openvpn_iphdr *iph, const char *prefix, const int dir= ection, const int msglevel)
+print_pkt(struct openvpn_iphdr *iph, const char *prefix, const int = direction, const msglvl_t msglevel)
{
= struct gc_arena gc =3D gc_new();

diff --= git a/src/openvpn/clinat.h b/src/openvpn/clinat.h
index abf= a0b7..7d787e0 100644
--- a/src/openvpn/clinat.h
<= span>+++ b/src/openvpn/clinat.h

@@ -54,11 +54,11 @@<= br> void copy_client_nat_option_list(struct client_nat_option_list *d= est,
const struct client_= nat_option_list *src);

-void print_client_nat_list(const struct client_nat_optio= n_list *list, int msglevel);
+void print_client_nat_list(const struct client_nat_option_list *li= st, msglvl_t msglevel);

void add_client_= nat_to_option_list(struct client_nat_option_list *dest, const char *type,
const char *network, con= st char *netmask,
- = const char *foreign_network, int msglevel);<= /span>
+ = const char *foreign_network, msglvl_t msglevel);
<= span>

void client_nat_transform(const struct client_nat_o= ption_list *list, struct buffer *ipbuf,
= const int direction);
diff --git a/src/openvpn/comp= .c b/src/openvpn/comp.c
index 1a2e775..9d35141 100644
--- a/src/openvpn/comp.c
+++ b/src/openvpn/comp.= c
@@ -159,7 +159,7 @@
#endif /* USE_COMP *= /

bool
-check_compression_settings_valid(struct compress_option= s *info, int msglevel)
+#include "error.h"
+
/**
* Chec= ks if the compression settings are valid. Takes into account the
= * flags of allow-compression and also the whether algorithms are co= mpiled
* in
*/
-bool check_compression_settings_valid(struct c= ompress_options *info, int msglevel);
+bool check_compression_settings_valid(struct compress_opt= ions *info, msglvl_t msglevel);

#ifdef U= SE_COMP
#include "buffer.h"
diff= --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index = 4c0f684..0abcd7f 100644
--- a/src/openvpn/crypto.c+++ b/src/openvpn/crypto.c
@@ -1609,7 +1609,7 @@
}

int
-ascii2keydirection(int msglevel, const ch= ar *str)
+ascii2keydi= rection(msglvl_t msglevel, const char *str)
{
if (!str)

{
diff --git a/src/= openvpn/crypto.h b/src/openvpn/crypto.h
index efd7f60..d69d= b59 100644
--- a/src/openvpn/crypto.h
+++ b= /src/openvpn/crypto.h
@@ -618,7 +618,7 @@
=
void must_have_n_keys(const char *filename, const char *o= ption, const struct key2 *key2, int n);

-int ascii2keydirection(int msglevel, co= nst char *str);
+int = ascii2keydirection(msglvl_t msglevel, const char *str);

const char *keydirection2ascii(int kd, bool remote, bool hu= manreadable);

diff --git a/src/openvpn/dc= o.c b/src/openvpn/dco.c
index 70a8c0a..881459c 100644
--- a/src/openvpn/dco.c
+++ b/src/openvpn/dco.c<= /span>
@@ -233,7 +233,7 @@
}

static bool
-dco_check_option_ce(const struct connection_entry *ce, int msglevel, i= nt mode)
+dco_check_o= ption_ce(const struct connection_entry *ce, msglvl_t msglevel, int mode)
{
if (ce->fragment)
= {
@@ -293,7 +293,7 @@
}

bool
-dco_check_startup_option(int msglevel, const struct options *o)=
+dco_check_startup_option(m= sglvl_t msglevel, const struct options *o)
{
/* check if no dev name was specified at all. In the case,
* later logic will most likely stop OpenVPN, so no need to
@@ -430,7 +430,7 @@
}

bool
-dco_= check_option(int msglevel, const struct options *o)
+dco_check_option(msglvl_t msglevel, const= struct options *o)
{
/* At this poin= t the ciphers have already been normalised */
if (o-&g= t;enable_ncp_fallback
@@ -480,7 +480,7 @@
= }

bool
-dco_check_pull_options(int msglevel, const struct optio= ns *o)
+dco_check_pul= l_options(msglvl_t msglevel, const struct options *o)
{
if (!o->use_peer_id)
{diff --git a/src/openvpn/dco.h b/src/openvpn/dco.h
i= ndex 59acb18..a362977 100644
--- a/src/openvpn/dco.h=
+++ b/src/openvpn/dco.h
@@ -55,7 +55,7 @@<= br> * @param msglevel level to print messages to
* @return true if ovpn-dco is available, false otherwise
*/
-bo= ol dco_available(int msglevel);
+bool dco_available(msglvl_t msglevel);
=

/**
@@ -75,7 +75,7 @@ * @param o the options struct that hold the options
* @return true if no conflict was detected, false oth= erwise
*/
-bool dco_check_option(int msglevel, const struct options *o);<= br>+bool dco_check_option(msglv= l_t msglevel, const struct options *o);

= /**
* Check whether the options struct has any further op= tion that is not supported
@@ -87,7 +87,7 @@
* @param o the options struct that hold the options

<= span> * @return true if no conflict was detected, false otherwise=

*/
-= bool dco_check_startup_option(int msglevel, const struct options *o);
+bool dco_check_startup_op= tion(msglvl_t msglevel, const struct options *o);
<= br> /**
* Check whether any of the options pushed b= y the server is not supported by
@@ -98,7 +98,7 @@ * @param o the options struct that hold the options
* @return true if no conflict was detected, false oth= erwise
*/
-bool dco_check_pull_options(int msglevel, const struct options *o);
+bool dco_check_pull_o= ptions(msglvl_t msglevel, const struct options *o);

/**
* Initialize the DCO context
@@ -261,7 +261,7 @@

typedef void *dco_context_t;

static inline bool
-dco_available(int msglevel)
+dco_available(msglvl_t msglevel)<= br> {
return false;
}@@ -273,19 +273,19 @@
}
static inline bool
-dco_check_option(int msglevel, const struct options *o)
+dco_check_option(msglvl_t msglevel= , const struct options *o)

{
return f= alse;
}

static inline b= ool
-dco_check_startup_= option(int msglevel, const struct options *o)
+dco_check_startup_option(msglvl_t msglevel, const= struct options *o)
{
return false;
}

static inline bool
-dco_check_pull_options(in= t msglevel, const struct options *o)
+dco_check_pull_options(msglvl_t msglevel, const struct opt= ions *o)
{
return false;
}

diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn= /dco_freebsd.c
index 65303cd..d5ca277 100644
--- a/src/openvpn/dco_freebsd.c

+++ b/src/openvpn/dco_fre= ebsd.c
@@ -658,7 +658,7 @@
}

bool
-dco_available(int msglevel)
+dco_available(msglvl_t msglevel)
{
= struct if_clonereq ifcr;
char *buf =3D NULL= ;
diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_li= nux.c
index 40674e7..d8357ca 100644
--- a/s= rc/openvpn/dco_linux.c
+++ b/src/openvpn/dco_linux.c=
@@ -74,7 +74,7 @@
* @return ID on success, nega= tive error code on error
*/
static int
-resolve_ovpn_netlink_id= (int msglevel)
+resol= ve_ovpn_netlink_id(msglvl_t msglevel)
{
= int ret;
struct nl_sock *nl_sock =3D nl_socket_allo= c();
@@ -1199,7 +1199,7 @@
}

bool
-dco_available(int msglevel)
+dco_available(msglvl_t msglevel)
{
= if (resolve_ovpn_netlink_id(D_DCO_DEBUG) < 0)
{

diff --git a/src/openvpn/dco_win.c b/src/openvpn/dc= o_win.c
index 01ba017..2d08ed8 100644
--- a= /src/openvpn/dco_win.c
+++ b/src/openvpn/dco_win.c@@ -599,7 +599,7 @@
}

= bool
-dco_availa= ble(int msglevel)
+dc= o_available(msglvl_t msglevel)
{
/* t= ry to open device by symbolic name */
HANDLE h =3D Cre= ateFile("\\\\.\\ovpn-dco", GENERIC_READ | GENERIC_WRITE, 0, NULL,= OPEN_EXISTING,
diff --git a/src/openvpn/dns.c b/src/openvp= n/dns.c
index 5421004..efb888a 100644
--- a= /src/openvpn/dns.c
+++ b/src/openvpn/dns.c
= @@ -200,7 +200,7 @@
}

b= ool
-dns_options_verify= (int msglevel, const struct dns_options *o)
+dns_options_verify(msglvl_t msglevel, const struct = dns_options *o)
{
const struct dns_se= rver *server =3D o->servers ? o->servers : o->servers_prepull;
while (server)
diff --git a/src/openvpn/d= ns.h b/src/openvpn/dns.h
index 6d97b40..6cd98f2 100644
--- a/src/openvpn/dns.h
+++ b/src/openvpn/dns.h=
@@ -166,7 +166,7 @@
* @param o = Pointer to the DNS options to validate
* @return = True if no error was found
*/
-bool dns_options_verify(int msglevel, con= st struct dns_options *o);
+bool dns_options_verify(msglvl_t msglevel, const struct dns_options = *o);

/**
* Makes a dee= p copy of the passed DNS options.
diff --git a/src/openvpn/= env_set.c b/src/openvpn/env_set.c
index 6c7df8e..2ae71ab 10= 0644
--- a/src/openvpn/env_set.c
+++ b/src/= openvpn/env_set.c
@@ -209,7 +209,7 @@
}

void
-env_set_print(int msglevel, const struct env_set *es)
+env_set_print(msglvl_t ms= glevel, const struct env_set *es)
{
i= f (check_debug_level(msglevel))
{
diff= --git a/src/openvpn/env_set.h b/src/openvpn/env_set.h
inde= x 3973a4e..ddcfa14 100644
--- a/src/openvpn/env_set.h
+++ b/src/openvpn/env_set.h
@@ -85,7 +85,7 @@

const char *env_set_get(const struct env_s= et *es, const char *name);

-void env_set_print(int msglevel, const struct env_se= t *es);
+void env_set= _print(msglvl_t msglevel, const struct env_set *es);

/**
* Write a struct env_set to a file. Each= item on one line.
diff --git a/src/openvpn/error.c b/src/o= penvpn/error.c
index 1b98235..58c2fd1 100644
--- a/src/openvpn/error.c

+++ b/src/openvpn/error.c
@@ -48,12 +48,12 @@
#endif

/* Globals */
-unsigned int x_debug_level; /* GLOBAL */
+msglvl_t x_debug_level; /* GLOBAL */
=
/* Mute state */
-static int mute_cutoff; /* GLOBAL */
-static int mute_count; /* GLOBAL */=
-static int mute_categ= ory; /* GLOBAL */
+st= atic int mute_cutoff; /* GLOBAL */
+static int mute_count; /* GLOBAL */+static msglvl_t mute_category= ; /* GLOBAL */

/*
* Ou= tput mode priorities are as follows:
@@ -103,16 +103,14 @@<= /span>
bool
set_debug_level(const int level, con= st unsigned int flags)
{
- const int ceiling =3D 15;
-
- if (level >=3D 0 && level <=3D ceiling)
= + if (level >=3D 0 &&= amp; level <=3D M_DEBUG_LEVEL)
{
- x_debug_level =3D level;<= br>+ x_debug_level =3D (= msglvl_t)level;
return true;
= }
else if (flags & SDL_CONSTRAIN)
= {
- x_debug= _level =3D constrain_int(level, 0, ceiling);
+ x_debug_level =3D (msglvl_t)constrain_int(= level, 0, M_DEBUG_LEVEL);
return true;
<= span> }

return false;
@@ -132,7 +1= 30,7 @@
}
}
<= br>-int
+msglvl_t
get_debug_level(voi= d)
{
return x_debug_level;
= @@ -190,7 +188,7 @@
* Return a file to print messag= es to before syslog is opened.
*/
FILE *=
-msg_fp(const unsigned= int flags)
+msg_fp(c= onst msglvl_t flags)
{
FILE *fp =3D m= sgfp;
if (!fp)
@@ -214,7 +212,7 @@
int x_msg_line_num; /* GLOBAL */

= void
-x_msg(cons= t unsigned int flags, const char *format, ...)
+x_msg(const msglvl_t flags, const char *format, = ...)
{
va_list arglist;
va_start(arglist, format);

@@ -235,7 +233,7 @@
}

void
-x_msg_va(const unsigned int flags, const c= har *format, va_list arglist)
+x_msg_va(const msglvl_t flags, const char *format, va_list arglis= t)
{
struct gc_arena gc;
#if SYSLOG_CAPABILITY

@@ -385,13 +383,13 @@
= * Apply muting filter.
*/
bool
-dont_mute(unsigned int = flags)
+dont_mute(msg= lvl_t flags)
{
bool ret =3D true;
if (mute_cutoff > 0 && !(flags & M_NOMUTE)= )
{
- if (mute_level > 0 &= & mute_level =3D=3D mute_category)
+ const msglvl_t mute_level =3D DECODE_MUTE_LEVEL(= flags);
+ if (= mute_level =3D=3D mute_category)
{
if (mute_count =3D=3D mute_cutoff)

= {
@@ -750,7 +748,7 @@
* Translate msg = flags into a string
*/
const char *
-msg_flags_string(const uns= igned int flags, struct gc_arena *gc)
+msg_flags_string(const msglvl_t flags, struct gc_arena *g= c)
{
struct buffer out =3D alloc_buf_= gc(16, gc);
if (flags =3D=3D M_INFO)
d= iff --git a/src/openvpn/error.h b/src/openvpn/error.h
index= 8388f82..2913498 100644
--- a/src/openvpn/error.h+++ b/src/openvpn/error.h
@@ -74,31 +74,33 @@
#define openvpn_errno() errno
#endif
+typedef uns= igned int msglvl_t;
+=
/*
* These globals should not be access= ed directly,
* but rather through macros or inline functi= ons defined below.
*/
-extern unsigned int x_debug_level;
+extern msglvl_t x_debug_level;
= extern int x_msg_line_num;

/* msg= () flags */

-#define M_DEBUG_LEVEL (0x0F) /* debug level mask */
+#define M_DEBUG_LEVEL (0x0Fu) /* de= bug level mask */


-#define M_FATAL (1 << 4) /* exit program */<= br>-#define M_NONFATAL (1 <<= ; 5) /* non-fatal error */
-#define M_WARN (1 << 6) /* call syslog with LOG_WARNING */=
-#define M_DEBUG (1= << 7)
+#define= M_FATAL (1u << 4) /* exit program */
+#define M_NONFATAL (1u << 5) /* non-fata= l error */
+#define M= _WARN (1u << 6) /* call syslog with LOG_WARNING */
+#define M_DEBUG (1u << 7= )


-#d= efine M_ERRNO (1 << 8) /* show errno description */+#define M_ERRNO (1u << = 8) /* show errno description */

-#define M_NOMUTE (1 << 11) = /* don't do mute processing */
-#define M_NOPREFIX (1 << 12) /* don't show date/= time prefix */
-#define= M_USAGE_SMALL (1 << 13) /* fatal options error, call usage_small */=
-#define M_MSG_VIRT_OU= T (1 << 14) /* output message through msg_status_output callback */
-#define M_OPTERR = (1 << 15) /* print "Options error:" prefix */
-#define M_NOLF (1 << = 16) /* don't print new line */

-#define M_NOIPREFIX (1 << 17) /* don't print inst= ance prefix */
+#defi= ne M_NOMUTE (1u << 11) /* don't do mute processing */
+#define M_NOPREFIX (1= u << 12) /* don't show date/time prefix */
+#define M_USAGE_SMALL (1u << 13) /= * fatal options error, call usage_small */
+#define M_MSG_VIRT_OUT (1u << 14) /* output me= ssage through msg_status_output callback */
+#define M_OPTERR (1u << 15) /* print &q= uot;Options error:" prefix */
+#define M_NOLF (1u << 16) /* don't print n= ew line */
+#define M= _NOIPREFIX (1u << 17) /* don't print instance prefix */=

/* flag combinations which are frequently used= */
#define M_ERR (M_FATAL | M_ERRNO)
@= @ -112,7 +114,7 @@
* A mute level of 0 is always printed.=
*/
#define MUTE_LEVEL_SHIFT 24-#define MUTE_LEVEL_MASK 0xFF<= /span>
+#define MUTE_LEVEL_M= ASK 0xFFu

#define ENCODE_MUTE_LEVEL(mut= e_level) (((mute_level) & MUTE_LEVEL_MASK) << MUTE_LEVEL_SHIFT)
#define DECODE_MUTE_LEVEL(flags) (((flags) >> MU= TE_LEVEL_SHIFT) & MUTE_LEVEL_MASK)
@@ -135,7 +137,7 @@<= /span>
*/

/** Check muting fi= lter */
-bool dont_mute= (unsigned int flags);
+bool dont_mute(msglvl_t flags);

/* Mac= ro to ensure (and teach static analysis tools) we exit on fatal errors */
#define EXIT_FATAL(flags) \
@@ -170,7 = +172,7 @@
#define dmsg(flags, ...)
#endif=

-voi= d x_msg(const unsigned int flags, const char *format, ...)
+void x_msg(const msglvl_t flags, con= st char *format, ...)
#ifdef __GNUC__
#if= __USE_MINGW_ANSI_STDIO
__attribute__((format(gnu_prin= tf, 2, 3)))
@@ -180,7 +182,7 @@
#endif
; /* should be called via msg above */
<= /span>
-void x_msg_va(const un= signed int flags, const char *format, va_list arglist);
+void x_msg_va(const msglvl_t flags, con= st char *format, va_list arglist);

/*
* Function prototypes
@@ -201,16 +203,16 @@=

bool set_mute_cutoff(const int cutoff);=

-int= get_debug_level(void);
+msglvl_t get_debug_level(void);

int = get_mute_cutoff(void);

-const char *msg_flags_string(const unsigned int flags, s= truct gc_arena *gc);
= +const char *msg_flags_string(const msglvl_t flags, struct gc_arena *gc);

/*
* File to print mess= ages to before syslog is opened.
*/
-FILE *msg_fp(const unsigned int flags);
+FILE *msg_fp(const msgl= vl_t flags);

/* Fatal logic errors */
#ifndef ENABLE_SMALL
@@ -254,14 +256,14 @@
/* Inline functions */

s= tatic inline bool
-chec= k_debug_level(unsigned int level)
+check_debug_level(msglvl_t level)
{ return (level & M_DEBUG_LEVEL) <=3D x_debug_level;
}

/** Return true if flags = represent an enabled, not muted log level */
static inline= bool
-msg_test(unsigne= d int flags)
+msg_tes= t(msglvl_t flags)
{
return check_debu= g_level(flags) && dont_mute(flags);
}
@@ -400,8 +402,8 @@

}

/** Convert fatal errors to nonfatal, don't touch other errors */
-static inline unsigned i= nt
-nonfatal(const unsi= gned int err)
+static= inline msglvl_t
+non= fatal(const msglvl_t err)
{
return er= r & M_FATAL ? (err ^ M_FATAL) | M_NONFATAL : err;
}
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 5d22fa3..12dd6a7 100644
--- a/src/openv= pn/forward.c
+++ b/src/openvpn/forward.c
@@= -368,7 +368,8 @@
}

boo= l
-send_control_channel= _string_dowork(struct tls_session *session, const char *str, int msglevel)<= /span>
+send_control_channel= _string_dowork(struct tls_session *session, const char *str,
+ = msglvl_t msglevel)

{
struct gc_arena= gc =3D gc_new();
bool stat;
@@ -395,7= +396,7 @@
}

bool
-send_control_channel_string= (struct context *c, const char *str, int msglevel)
+send_control_channel_string(struct context *= c, const char *str, msglvl_t msglevel)
{
= if (c->c2.tls_multi)
{
diff --g= it a/src/openvpn/forward.h b/src/openvpn/forward.h
index 79= d0f8b..a575faf 100644
--- a/src/openvpn/forward.h+++ b/src/openvpn/forward.h
@@ -285,7 +285,7 @@

* @param str - The message to be sent
= * @param msglevel - Message level to use for logging
= */
-bool send_control_c= hannel_string(struct context *c, const char *str, int msglevel);
= +bool send_control_channel_stri= ng(struct context *c, const char *str, msglvl_t msglevel);
=
/*
* Send a string to remote over the = TLS control channel.
@@ -303,7 +303,8 @@
= * @param msglevel - Message level to use for logging
*/=

-boo= l send_control_channel_string_dowork(struct tls_session *session, const cha= r *str, int msglevel);
+ = msglvl_t msglevel);


/**
diff --git a/src/openvp= n/init.c b/src/openvpn/init.c
index 2821cd4..0d7a2ec 100644=
--- a/src/openvpn/init.c
+++ b/src/openvpn= /init.c
@@ -4273,7 +4273,7 @@
}
=
void
-management_show_net_callback(void *arg, const int msglevel)<= br>+management_show_net_callbac= k(void *arg, const msglvl_t msglevel)
{
#= ifdef _WIN32
show_routes(msglevel);
di= ff --git a/src/openvpn/init.h b/src/openvpn/init.h
index a8= 07874..e89615b 100644
--- a/src/openvpn/init.h
+++ b/src/openvpn/init.h

@@ -136,7 +136,7 @@
=
void close_management(void);

-void management_show_net_= callback(void *arg, const int msglevel);
+void management_show_net_callback(void *arg, const msg= lvl_t msglevel);

#endif
=
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c<= /span>
index 4decdfe..c675e95 100644
--- a/src/ope= nvpn/manage.c
+++ b/src/openvpn/manage.c
@@= -1475,7 +1475,7 @@
}
els= e
{
- msg(M_CLIENT, "SUCCESS: verb=3D%d", get_debug_= level());
+ = msg(M_CLIENT, "SUCCESS: verb=3D%u", get_debug_level());<= br> }
}
else if (st= req(p[0], "mute"))
diff --git a/src/openvpn/manag= e.h b/src/openvpn/manage.h
index 7c189ba..bff96d3 100644
--- a/src/openvpn/manage.h
+++ b/src/openvpn/= manage.h
@@ -176,7 +176,7 @@
unsigned = int flags;

void (*status)(void *arg,= const int version, struct status_output *so);
- void (*show_net)(void *arg, const int msglevel= );
+ void (*show_n= et)(void *arg, const msglvl_t msglevel);
int (*kill_by= _cn)(void *arg, const char *common_name);
int (*kill_b= y_addr)(void *arg, const in_addr_t addr, const int port, const int proto);<= /span>
void (*delete_event)(void *arg, event_t event);=
diff --git a/src/openvpn/mtu.c b/src/openvpn/mtu.c
index a419e32..9c1a772 100644

--- a/src/openvpn/mtu.c
+++ b/src/openvpn/mtu.c
@@ -187,7 +187,7 @@
}

void
-frame_print(const struct frame *frame, i= nt level, const char *prefix)
+frame_print(const struct frame *frame, msglvl_t msglevel, const c= har *prefix)
{
struct gc_arena gc =3D= gc_new();
struct buffer out =3D alloc_buf_gc(256, &am= p;gc);
@@ -208,7 +208,7 @@
buf_printf(= &out, " ET:%d", frame->extra_tun);
bu= f_printf(&out, " ]");

- msg(level, "%s", out.data);
+ msg(msglevel, &qu= ot;%s", out.data);
gc_free(&gc);
}


diff --git a/src/openvpn/mtu.h b/s= rc/openvpn/mtu.h
index c092461..3bbff6f 100644
--- a/src/openvpn/mtu.h

+++ b/src/openvpn/mtu.h<= br>@@ -181,7 +181,7 @@
* Function prototypes.
*/

-void frame_print(const struct frame *frame, int level, const ch= ar *prefix);
+void fr= ame_print(const struct frame *frame, msglvl_t msglevel, const char *prefix)= ;

void set_mtu_discover_type(socket_desc= riptor_t sd, int mtu_type, sa_family_t proto_af);
<= br>diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
<= span>index 6e4cc42..8676a09 100644

--- a/src/openvpn/multi.= c
+++ b/src/openvpn/multi.c
@@ -3316,7 +331= 6,7 @@
}
else
= {
- int msglev= el =3D D_DCO;
+ = msglvl_t msglevel =3D D_DCO;
if (dco->dco_mes= sage_type =3D=3D OVPN_CMD_DEL_PEER
&& = dco->dco_del_peer_reason =3D=3D OVPN_DEL_PEER_REASON_USERSPACE) {
diff --git a/src/openvpn/options.c b/src= /openvpn/options.c
index ae285d9..f1f66b9 100644
= --- a/src/openvpn/options.c
+++ b/src/openvpn/options= .c
@@ -1107,7 +1107,7 @@
#endif /* ifndef = _WIN32 */

static in_addr_t
-get_ip_addr(const char *ip_string, = int msglevel, bool *error)

+get_ip_addr(const char *ip_string, msglvl_t msglevel, bool *error)
{
unsigned int flags =3D GETADDR_HOST_= ORDER;
bool succeeded =3D false;
@@ -1= 187,7 +1187,7 @@
* @param gc The returned obje= ct will be allocated in this gc
*/
stati= c struct verify_hash_list *
-parse_hash_fingerprint(const char *str, int nbytes, int msglevel, str= uct gc_arena *gc)
+pa= rse_hash_fingerprint(const char *str, int nbytes, msglvl_t msglevel, struct= gc_arena *gc)
{
int i =3D 0;<= br> const char *cp =3D str;
@@ -1240,7 +1240,8 @@=
* @param gc The returned list items will be a= llocated in this gc
*/
static struct ver= ify_hash_list *
-parse_= hash_fingerprint_multiline(const char *str, int nbytes, int msglevel, struc= t gc_arena *gc)
+pars= e_hash_fingerprint_multiline(const char *str, int nbytes, msglvl_t msglevel= ,
+ = struct gc_arena *gc)
{
= struct gc_arena gc_temp =3D gc_new();
char *lines =3D= string_alloc(str, &gc_temp);
@@ -1329,7 +1330,7 @@
#endif /* ifdef _WIN32 */

= static void
-dhcp_optio= n_dns6_parse(const char *parm, struct in6_addr *dns6_list, int *len, int ms= glevel)
+dhcp_option_= dns6_parse(const char *parm, struct in6_addr *dns6_list, int *len, msglvl_t= msglevel)
{
struct in6_addr addr;
if (*len >=3D N_DHCP_ADDR)
@@ -1344,7= +1345,7 @@
}
static void
dhcp_option_address_parse(const char *name, const char *parm, in_addr_t *= array, int *len,

- = int msglevel)
+ msglvl_t msglevel)
{

if (*len >=3D N_DHCP_ADDR)
= {
@@ -1480,7 +1481,8 @@
#endif /* ! ENABL= E_SMALL */

static void
-option_iroute(struct options *o, const = char *network_str, const char *netmask_str, int msglevel)
+option_iroute(struct options *o, cons= t char *network_str, const char *netmask_str,
+ msglvl_t msglevel)
= {
struct iroute *ir;

@@ -1506,7 +1508,7 @@

}

static void

-option_= iroute_ipv6(struct options *o, const char *prefix_str, int msglevel)=
+option_iroute_ipv6(struct = options *o, const char *prefix_str, msglvl_t msglevel)
{
struct iroute_ipv6 *ir;

@@ -2063,7 +2065,7 @@

}

static struct local_entry *

-alloc_local_entry(struct connection_entry *ce, const int msglevel= , struct gc_arena *gc)
-alloc_connection_entry(struct op= tions *options, const int msglevel)
+alloc_connection_entry(struct options *options, const msglv= l_t msglevel)
{
struct connection_lis= t *l =3D alloc_connection_list_if_undef(options);
stru= ct connection_entry *e;
@@ -2140,7 +2142,7 @@
}


static struct remote_entry *
-alloc_remote_entry(struct o= ptions *options, const int msglevel)
+alloc_remote_entry(struct options *options, const msglvl_t= msglevel)
{
struct remote_list *l = =3D alloc_remote_list_if_undef(options);
struct remote= _entry *e;
@@ -2694,7 +2696,7 @@
if (!options->tls_server && !options->tls_client= )
{
+ msglvl_t msglevel =3D M_USAGE;
= if (options->allow_deprecated_insecure_static_crypto)
{

msglevel =3D M_INFO;
= @@ -4566,8 +4568,9 @@
}

= static void
-opt= ions_warning_safe_scan2(const int msglevel, const int delim, const bool rep= ort_inconsistent,
- = const char *p1, const struct buffer *b2_src, const c= har *b1_name,
+option= s_warning_safe_scan2(const msglvl_t msglevel, const int delim,
+ const= bool report_inconsistent, const char *p1,

+ const struct buffer *b2_s= rc, const char *b1_name,
const = char *b2_name)
{
/* We will stop send= ing 'key-method', 'keydir', 'proto' and 'tls-au= th' in
@@ -4619,9 +4622,9 @@
}<= br>
static void
-options_warning_safe_scan1(const int msglevel, const int = delim, const bool report_inconsistent,
- const struct buffer *b1_src, co= nst struct buffer *b2_src,
- const char *b1_name, const char *b2_name)
+options_warning_safe_= scan1(const msglvl_t msglevel, const int delim,
+ const bool report_in= consistent, const struct buffer *b1_src,
+ const struct buffer *b2_src= , const char *b1_name, const char *b2_name)
{
struct gc_arena gc =3D gc_new();

struct buffe= r b =3D *b1_src;
@@ -4637,7 +4640,7 @@
}

static void
-options_warning_safe_ml(const int msglevel, char *a= ctual, const char *expected, size_t actual_n)
+options_warning_safe_ml(const msglvl_t msglevel, = char *actual, const char *expected, size_t actual_n)
{
struct gc_arena gc =3D gc_new();
=
@@ -4729,7 +4732,7 @@
*/

int
-parse= _topology(const char *str, const int msglevel)
+parse_topology(const char *str, const msglvl_t m= sglevel)
{
if (streq(str, "net30= "))
{
@@ -4785,7 +4788,7 @@
}

bool
-auth_retry_set(const int msglevel, const ch= ar *option)
+auth_ret= ry_set(const msglvl_t msglevel, const char *option)
{
if (streq(option, "interact"))
= {
@@ -4942,7 +4945,7 @@

#if 0

static void
-ping_rec_err(int msglevel)
+ping_rec_err(msglvl_t msglevel)
{<= /span>
msg(msglevel, "only one of --ping-exit or --ping-= restart options may be specified");
}
@@ -4966,7 +4969,7 @@


int
parse_line(const char *line, char *p[], const int n, const char *file, = const int line_num,

- = int msglevel, struct gc_arena *gc)
+ msglvl_t msglevel, struct gc_arena *gc)<= /span>
{
const int STATE_INITIAL =3D 0;
const int STATE_READING_QUOTED_PARM =3D 1;
@@ -5271,24 +5274,25 @@

}

static void add_option(struct options *options, char *p[], bool is_inli= ne, const char *file,

-= int line, const int level, const int msglevel,
+ in= t line, const int level, const msglvl_t msglevel,
= const unsigned int permission_mask, unsigned int *option_typ= es_found,
struct env_set *es);

static void remove_option(struct context *c,= struct options *options, char *p[], bool is_inline,
- const char *file,= int line, const int msglevel,
+ const char *file, int line, const msgl= vl_t msglevel,
const unsigned in= t permission_mask, unsigned int *option_types_found,
= struct env_set *es);

static void update_option(struct context *c, struct options *options, cha= r *p[], bool is_inline,

- const char *file, int line, const int level, co= nst int msglevel,
+ = const char *file, int line, const int level, const = msglvl_t msglevel,
const unsigne= d int permission_mask, unsigned int *option_types_found,
= struct env_set *es, unsigned int *update_options_f= ound);

static void
read= _config_file(struct options *options, const char *file, int level, const ch= ar *top_file,
- = const int top_line, const int msglevel, const unsigned int permiss= ion_mask,
- = unsigned int *option_types_found, struct env_set *es)
+ const int top_line,= const msglvl_t msglevel,
+ const unsigned int permission_mask, unsigned int *op= tion_types_found,
+ = struct env_set *es)
{
= const int max_recursive_levels =3D 10;
FILE *fp;
@@ -5360,7 +5364,7 @@

static = void
read_config_string(const char *prefix, struct options= *options, const char *config,
- const int msglevel, const unsigned int permissi= on_mask,
+ = const msglvl_t msglevel, const unsigned int permission_mask,=
unsigned int *option_types_found, struct env_= set *es)
{
char line[OPTION_LINE_SIZE= ];
@@ -5388,7 +5392,7 @@
}

void
+parse_= argv(struct options *options, const int argc, char *argv[], const msglvl_t = msglevel,
const unsigned int permission_mask, u= nsigned int *option_types_found, struct env_set *es)
{
/* usage message */
@@ -5457,7 +5461,7 @@=
char line[OPTION_PARM_SIZE];
int= line_num =3D 0;
const char *file =3D "[PUSH-OPTI= ONS]";
- const = int msglevel =3D D_PUSH_ERRORS | M_OPTERR;
+ const msglvl_t msglevel =3D D_PUSH_ERRORS | M_OP= TERR;
unsigned int update_options_found =3D 0;<= br>
while (buf_parse(buf, ',', line, si= zeof(line)))
@@ -5514,7 +5518,7 @@
}

void
-options_server_import(struct options *o, const char *filename,= int msglevel,
+optio= ns_server_import(struct options *o, const char *filename, msglvl_t msglevel= ,
unsigned int permission_mask, unsi= gned int *option_types_found,
struct= env_set *es)
{
@@ -5524,7 +5528,7 @@
}

void
-options_string_import(struct options *opti= ons, const char *config, const int msglevel,
+options_string_import(struct options *options, con= st char *config, const msglvl_t msglevel,
= const unsigned int permission_mask, unsigned int *option_types_found,=
struct env_set *es)
{

@@ -5543,7 +5547,7 @@

static bool

verify_permission(const char *name, const ch= ar *file, int line, const unsigned int type,
- const unsigned int allowed, unsign= ed int *found, const int msglevel,
+ const unsigned int allowed, unsigned int *= found, const msglvl_t msglevel,
struct o= ptions *options, bool is_inline)
{
if= (!(type & allowed))
@@ -5595,7 +5599,7 @@
#define NM_QUOTE_HINT (1 << 0)


static bool

-no_more_= than_n_args(const int msglevel, char *p[], const int max, const unsigned in= t flags)
+no_more_tha= n_n_args(const msglvl_t msglevel, char *p[], const int max, const unsigned = int flags)
{
const int len =3D string= _array_len((const char **)p);

@@ -5619,8 = +5623,8 @@
}
}

-static inline int-msglevel_forward_compatible(st= ruct options *options, const int msglevel)
+static inline msglvl_t
+msglevel_forward_compatible(struct options *optio= ns, const msglvl_t msglevel)
{
return= options->forward_compatible ? M_WARN : msglevel;
}
@@ -5654,10 +5658,11 @@
*/
= static void
remove_option(struct context *c, struct option= s *options, char *p[], bool is_inline,
- const char *file, int line, const int msglev= el, const unsigned int permission_mask,
- unsigned int *option_types_found, struct en= v_set *es)
+ = const char *file, int line, const msglvl_t msglevel,
+ const unsigned int perm= ission_mask, unsigned int *option_types_found,
+ struct env_set *es)
{

- int msglevel_= fc =3D msglevel_forward_compatible(options, msglevel);
+ msglvl_t msglevel_fc =3D msglevel_fo= rward_compatible(options, msglevel);

= if (streq(p[0], "ifconfig") && !p[1])
= {
@@ -5792,11 +5797,10 @@
#endif=
else
{
- int i;
- int msglevel_unknown =3D msglevel_fc;
+ msglvl_t msglevel_unknown = =3D msglevel_fc;

/* Check if an option is in --ign= ore-unknown-option and
* set warning level to non= fatal */
- for = (i =3D 0; options->ignore_unknown_option && options->ignore_u= nknown_option[i]; i++)
-check_route_option(struct options *= options, char *p[], const int msglevel, bool pull_mode)
+check_route_option(struct options *opti= ons, char *p[], const msglvl_t msglevel, bool pull_mode)
{=
rol_check_alloc(options);
if (pu= ll_mode)
@@ -5843,7 +5847,7 @@

=
static bool
-check_route6_option(struct options *options, char *p[], cons= t int msglevel, bool pull_mode)
+check_route6_option(struct options *options, char *p[], const m= sglvl_t msglevel, bool pull_mode)
{
r= ol6_check_alloc(options);
if (pull_mode)
@@ -5864,7 +5868,7 @@

}

static bool

-check_= dns_option(struct options *options, char *p[], const int msglevel, bool pul= l_mode)
+check_dns_op= tion(struct options *options, char *p[], const msglvl_t msglevel, bool pull= _mode)
{
if (streq(p[1], "search= -domains") && p[2])
{
@@ = -5984,7 +5988,7 @@
*/
static void=
update_option(struct context *c, struct options *options, char *= p[], bool is_inline,
- = const char *file, int line, const int level, const int msgleve= l,
+ con= st char *file, int line, const int level, const msglvl_t msglevel, const unsigned int permission_mask, unsigned int *op= tion_types_found,
struct env_set *es, unsign= ed int *update_options_found)
{
@@ -6169,1= 2 +6173,12 @@

static void
add_option(struct options *options, char *p[], bool is_inline, const cha= r *file, int line,

- = const int level, const int msglevel, const unsigned int permission_= mask,
+ con= st int level, const msglvl_t msglevel, const unsigned int permission_mask,<= /span>
unsigned int *option_types_found, struct env_se= t *es)
{
struct gc_arena gc =3D gc_ne= w();
const bool pull_mode =3D BOOL_CAST(permission_mas= k & OPT_P_PULL_MODE);
- int msglevel_fc =3D msglevel_forward_compatible(options, msglevel);=
+ msglvl_t msglev= el_fc =3D msglevel_forward_compatible(options, msglevel);
=
ASSERT(MAX_PARMS >=3D 7);
=
@@ -9869,7 +9873,7 @@
else
= {
int i;
- int msglevel_unknown =3D msglevel_fc;
+ msglvl_t msglevel_unknown= =3D msglevel_fc;

/* Check if an option is in --ig= nore-unknown-option and
* set warning level to no= n fatal */
for (i =3D 0; options->ignore_unknow= n_option && options->ignore_unknown_option[i]; i++)
diff --git a/src/openvpn/options.h b/src/openvpn/options.h

index bb2c052..a737711 100644

--- a/src/openvpn/options= .h
+++ b/src/openvpn/options.h
@@ -822,7 +8= 22,7 @@
struct pull_filter *tail;
};<= /span>

-void= parse_argv(struct options *options, const int argc, char *argv[], const in= t msglevel,
+void par= se_argv(struct options *options, const int argc, char *argv[], const msglvl= _t msglevel,
const unsigned int permission= _mask, unsigned int *option_types_found,
s= truct env_set *es);

@@ -888,7 +888,7 @@

void options_detach(struct options *o);

-void = options_server_import(struct options *o, const char *filename, int msglevel= ,
+void options_serve= r_import(struct options *o, const char *filename, msglvl_t msglevel,=
unsigned int permission_mask, unsigne= d int *option_types_found,
stru= ct env_set *es);

@@ -897,13 +897,13 @@
void rol_check_alloc(struct options *options);

int parse_line(const char *line, char *p[], const int= n, const char *file, const int line_num,
- int msglevel, struct gc_arena *gc);
+ msglvl_t = msglevel, struct gc_arena *gc);

/*
* parse/print topology coding
*/
<= span>

-int parse_topol= ogy(const char *str, const int msglevel);
+int parse_topology(const char *str, const msglvl_t ms= glevel);

const char *print_topology(cons= t int topology);

@@ -917,11 +917,11 @@

int auth_retry_get(void);
=
-bool auth_retry_set(= const int msglevel, const char *option);
+bool auth_retry_set(const msglvl_t msglevel, const cha= r *option);

const char *auth_retry_print= (void);

-void options_string_import(struct options *options, const char *config,= const int msglevel,
= +void options_string_import(struct options *options, const char *config, co= nst msglvl_t msglevel,
const un= signed int permission_mask, unsigned int *option_types_found,
struct env_set *es);


diff --git a/src/openvpn/options_util.c b/src/openvpn/options_ut= il.c
index 5740ee5..cb4229e 100644
--- a/sr= c/openvpn/options_util.c
+++ b/src/openvpn/options_util.c
@@ -117,7 +117,7 @@
}

int
-posi= tive_atoi(const char *str, int msglevel)
+positive_atoi(const char *str, msglvl_t msglevel)
{
char *endptr;
long= long i =3D strtoll(str, &endptr, 10);
@@ -132,7 +132,7= @@
}

bool
-positive_atoll(const char *str, in= t64_t *value, const char *name, int msglevel)

+positive_atoll(const char *str, int64_t *value, c= onst char *name, msglvl_t msglevel)
{
= char *endptr;
long long ll =3D strtoll(str, &endp= tr, 10);
@@ -148,7 +148,7 @@
}
<= span>

int
-atoi_warn(const char *str, int msglevel)
+atoi_warn(const char *str, msglvl_t msglevel)
{
char *endptr;
lo= ng long i =3D strtoll(str, &endptr, 10);
@@ -163,7 +163= ,7 @@
}

bool
= -atoi_constrained(const char *str= , int *value, const char *name, int min, int max, int msglevel)
<= span style=3D"color: hsl(120, 100%, 40%);">+atoi_constrained(const char *st= r, int *value, const char *name, int min, int max, msglvl_t msglevel)
{
ASSERT(min < max);
<= /span>
diff --git a/src/openvpn/options_util.h b/src/openvpn/optio= ns_util.h
index 45417d9..1492eef 100644
---= a/src/openvpn/options_util.h
+++ b/src/openvpn/options_uti= l.h
@@ -37,7 +37,7 @@
* Converts a str to= a positive number if the string represents a postive
* i= nteger number. Otherwise print a warning with msglevel and return 0<= br> */
-int posi= tive_atoi(const char *str, int msglevel);
+int positive_atoi(const char *str, msglvl_t msglevel)= ;

/**
* Converts a str= to an integer if the string can be represented as an
@@ -4= 8,13 +48,13 @@
*
* @return \c true if t= he integer has been parsed and stored in value, \c false otherwise */
-bool posi= tive_atoll(const char *str, int64_t *value, const char *name, int msglevel)= ;
+bool positive_atol= l(const char *str, int64_t *value, const char *name, msglvl_t msglevel);

/**
* Converts a str to = an integer if the string can be represented as an
* integ= er number. Otherwise print a warning with \p msglevel and return 0 */
-int atoi_= warn(const char *str, int msglevel);
+int atoi_warn(const char *str, msglvl_t msglevel);<= br>
/**
* Converts a str to an in= teger if the string can be represented as an
@@ -66,7 +66,7= @@
* @return \c true if the integer has been parsed and = stored in value, \c false otherwise
*/
b= ool atoi_constrained(const char *str, int *value, const char *name, int min= , int max,
- = int msglevel);
+ msglvl_t msglevel);
/**
* Filter an option line by all pull filters.<= /span>
diff --git a/src/openvpn/packet_id.c b/src/openvpn/packet_i= d.c
index 09696db..ca318eb 100644
--- a/src= /openvpn/packet_id.c
+++ b/src/openvpn/packet_id.c@@ -53,15 +53,15 @@
#define SEQ_EXPIRED ((time_t)1= )

#ifdef ENABLE_DEBUG
-static void packet_id_debug_print(int ms= glevel, const struct packet_id_rec *p,
+static void packet_id_debug_print(msglvl_t msglevel, con= st struct packet_id_rec *p,
= const struct packet_id_net *pin, const char *message,
= packet_id_print_type value);

#endif /* ENABLE_DEBUG */
static inline void
-packet_id_debug(int msglevel, const struct packet_id_rec *p, const st= ruct packet_id_net *pin,
+packet_id_debug(msglvl_t msglevel, cons= t struct packet_id_rec *p,
+ const struct packet_id_net *pin, const char *message= , uint64_t value)
{
#ifdef ENABLE_DEBUG
if (unlikely(check_debug_level(msglevel)))
@@ -573,7 +573,8 @@

#ifdef ENABLE_DEBUG

static void
-packet_id_debug_print(int msglevel, const struct packet_id_rec *= p, const struct packet_id_net *pin,
+packet_id_debug_print(msglvl_t msglevel, const struct packe= t_id_rec *p,
+ = const struct packet_id_net *pin,
= const char *message, packet_id_print_type value)
{

struct gc_arena gc =3D gc_new();
= diff --git a/src/openvpn/pkcs11.c b/src/openvpn/pkcs11.c
in= dex dfc87f6..8a7a320 100644
--- a/src/openvpn/pkcs11.c
+++ b/src/openvpn/pkcs11.c
@@ -72,10 +72,10 @@<= /span>
#endif
};

-static unsigned

+static msglvl_t
_pkcs1= 1_msg_pkcs112openvpn(const unsigned flags)
{
- unsigned openvpn_flags;
<= br>+ msglvl_t openvpn_flags;=

switch (flags)
= {
@@ -112,7 +112,7 @@
}
=
static unsigned
-_pkcs11_msg_openvpn2pkcs11(const unsigned flags)
+_pkcs11_msg_openvpn2pkcs11(const m= sglvl_t flags)

{
unsigned pkcs11_flag= s;

diff --git a/src/openvpn/plugin.c b/sr= c/openvpn/plugin.c
index ea76a08..a105058 100644
= --- a/src/openvpn/plugin.c
+++ b/src/openvpn/plugin.c=
@@ -50,7 +50,7 @@
static struct plugin_co= mmon *static_plugin_common =3D NULL; /* GLOBAL */
<= br> static void
-= plugin_show_string_array(int msglevel, const char *name, const char *array[= ])
+plugin_show_strin= g_array(msglvl_t msglevel, const char *name, const char *array[]) {
int i;
for (i =3D 0; ar= ray[i]; ++i)
@@ -63,7 +63,7 @@
}
static void
-plugin_show_args_env(int msglevel, const char *argv[], cons= t char *envp[])
+plug= in_show_args_env(msglvl_t msglevel, const char *argv[], const char *envp[])=
{
if (check_debug_level(msglevel))
{
@@ -184,7 +184,7 @@
=
#ifndef ENABLE_SMALL
void
-plugin_option_list_print(const struc= t plugin_option_list *list, int msglevel)

+plugin_option_list_print(const struct plugin_option_l= ist *list, msglvl_t msglevel)
{
int i= ;
struct gc_arena gc =3D gc_new();
@@ = -995,7 +995,7 @@

#ifdef ENABLE_DEBUG
void
-plu= gin_return_print(const int msglevel, const char *prefix, const struct plugi= n_return *pr)
+plugin= _return_print(const msglvl_t msglevel, const char *prefix, const struct plu= gin_return *pr)
{
int i;
msg(msglevel, "PLUGIN_RETURN_PRINT %s", prefix);
<= br>diff --git a/src/openvpn/plugin.h b/src/openvpn/plugin.hindex 63999b6..81d3739 100644
--- a/src/openvpn/plug= in.h
+++ b/src/openvpn/plugin.h
@@ -111,7 += 111,7 @@
bool plugin_option_list_add(struct plugin_option_= list *list, char **p, struct gc_arena *gc);

#ifndef ENABLE_SMALL

+void plu= gin_option_list_print(const struct plugin_option_list *list, msglvl_t msgle= vel);

#endif
@@ -136,7 +136,7 @@
void plugin_return_free(struct = plugin_return *pr);

#ifdef ENABLE_DEBUG<= /span>
-void plugin_return_pri= nt(const int msglevel, const char *prefix, const struct plugin_return *pr);=
+void plugin_return_= print(const msglvl_t msglevel, const char *prefix, const struct plugin_retu= rn *pr);

#endif
=
diff --git a/src/openvpn/pool.c b/src/openvpn/pool.c
index fde6cea..28ddd2c 100644

--- a/src/openvpn/pool.c<= /span>
+++ b/src/openvpn/pool.c
@@ -114,7 +114,7 @= @
* Verify start/end range
*/ bool
-ifconfig_= pool_verify_range(const int msglevel, const in_addr_t start, const in_addr_= t end)
+ifconfig_pool= _verify_range(const msglvl_t msglevel, const in_addr_t start, const in_addr= _t end)
{
struct gc_arena gc =3D gc_n= ew();
bool ret =3D true;
diff --git a/= src/openvpn/pool.h b/src/openvpn/pool.h
index 6cecef0..36e9= fca 100644
--- a/src/openvpn/pool.h
+++ b/s= rc/openvpn/pool.h
@@ -78,7 +78,7 @@

void ifconfig_pool_free(struct ifconfig_pool *pool);
=
-bool ifconfig_= pool_verify_range(const int msglevel, const in_addr_t start, const in_addr_= t end);
+bool ifconfi= g_pool_verify_range(const msglvl_t msglevel, const in_addr_t start, const i= n_addr_t end);

ifconfig_pool_handle ifco= nfig_pool_acquire(struct ifconfig_pool *pool, in_addr_t *local,
<= span> in_addr_t *remote, struct = in6_addr *remote_ipv6,

diff --git a/src/openvpn/proto.c b/s= rc/openvpn/proto.c
index 34b3378..ab77887 100644
= --- a/src/openvpn/proto.c
+++ b/src/openvpn/proto.c
@@ -183,7 +183,7 @@
int hlen;
int totlen;
const = char *msgstr =3D "PACKET SIZE INFO";
- unsigned int msglevel =3D D_PACKET_TRU= NC_DEBUG;
+ = msglvl_t msglevel =3D D_PACKET_TRUNC_DEBUG;

<= span> if (BLEN(&buf) < (int)sizeof(struct openvpn_iphdr)= )

{
diff --git a/src/openvpn/p= ush.c b/src/openvpn/push.c
index 1ea7ed9..60ca25f 100644
--- a/src/openvpn/push.c
+++ b/src/openvpn/pu= sh.c
@@ -373,8 +373,8 @@
*
* @return true on success, false on failure.

*/
-static bool push_option_fmt= (struct gc_arena *gc, struct push_list *push_list, int msglevel,
= - cons= t char *fmt, ...)
+st= atic bool push_option_fmt(struct gc_arena *gc, struct push_list *push_list,=
+ = msglvl_t msglevel, const char *fmt, ...)
#ifdef _= _GNUC__
#if __USE_MINGW_ANSI_STDIO
__= attribute__((format(gnu_printf, 4, 5)))
@@ -853,7 +853,7 @@=

static void
push_optio= n_ex(struct gc_arena *gc, struct push_list *push_list, const char *opt, boo= l enable,
- = int msglevel)
+ = msglvl_t msglevel)
{
if (= !string_class(opt, CC_ANY, CC_COMMA))
{
@@ -881,7 +881,7 @@

}

= void
-push_option(stru= ct options *o, const char *opt, int msglevel)
+push_option(struct options *o, const char *opt, m= sglvl_t msglevel)
{
push_option_ex(&a= mp;o->gc, &o->push_list, opt, true, msglevel);
}=
@@ -902,7 +902,7 @@
}

void
-p= ush_options(struct options *o, char **p, int msglevel, struct gc_arena *gc)=
+push_options(struct= options *o, char **p, msglvl_t msglevel, struct gc_arena *gc)
{

const char **argv =3D make_extended_arg_array(p= , false, gc);
char *opt =3D print_argv(argv, gc, 0);
@@ -910,8 +910,8 @@
}

static bool
-push_option_fmt(struct gc_arena *gc, struct push_list *push_list, int m= sglevel, const char *format,
- ...)
+push_option_fmt(struct gc_arena *gc, struct push_list *push_list,
+ msglv= l_t msglevel, const char *format, ...)
{
= va_list arglist;
char tmp[256] =3D { 0 };diff --git a/src/openvpn/push.h b/src/openvpn/push.h
index 8ffd0c2..6b3275e 100644

--- a/src/openvpn/push.h
+++ b/src/openvpn/push.h
@@ -99,9 +99,9 @@

void clone_push_list(struct options *o);

-void = push_option(struct options *o, const char *opt, int msglevel);
+void push_option(struct options = *o, const char *opt, msglvl_t msglevel);


-void push_options(struct options *o, c= har **p, int msglevel, struct gc_arena *gc);
+void push_options(struct options *o, char **p, msg= lvl_t msglevel, struct gc_arena *gc);

vo= id push_reset(struct options *o);

diff --= git a/src/openvpn/route.c b/src/openvpn/route.c
index e5044= 85..aa5ce69 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c

@@ -1228,28 +1228,28 @@<= br> }

static void
-print_route_option(const struct route_= option *ro, int level)
- ms= g(level, " route %s/%s/%s/%s", show_opt(ro->network), show_op= t(ro->netmask),
+ = msg(msglevel, " route %s/%s/%s/%s", show_opt(ro->network),= show_opt(ro->netmask),
show_opt(ro->gateway= ), show_opt(ro->metric));
}
void
-print_rou= te_options(const struct route_option_list *rol, int level)
+print_route_options(const struct rou= te_option_list *rol, msglvl_t msglevel)
{
= struct route_option *ro;
if (rol->flags & = RG_ENABLE)
{
- msg(level, " [redirect_default_gateway local=3D%d= ]", (rol->flags & RG_LOCAL) !=3D 0);
+ msg(msglevel, " [redirect_defaul= t_gateway local=3D%d]", (rol->flags & RG_LOCAL) !=3D 0);=
}
for (ro =3D rol->routes; ro; ro = =3D ro->next)
{
- print_route_option(ro, level);
+ print_route_option(ro, msgleve= l);
}
}

<= span> void

-print_defau= lt_gateway(const int msglevel, const struct route_gateway_info *rgi,=
+print_default_gateway(cons= t msglvl_t msglevel, const struct route_gateway_info *rgi,
= const struct route_ipv6_gateway_info *rgi6) {
struct gc_arena gc =3D gc_new();
= @@ -1323,23 +1323,23 @@
#endif /* ifndef ENABLE_SMAL= L */

static void
-print_route(const struct route_ipv4 *r, int= level)
+print_route(= const struct route_ipv4 *r, msglvl_t msglevel)
{ struct gc_arena gc =3D gc_new();
if (r->= ;flags & RT_DEFINED)
{
- msg(level, "%s", route_string(r= , &gc));
+ = msg(msglevel, "%s", route_string(r, &gc));
= }
gc_free(&gc);
}
<= span>

void
-print_routes(const struct route_list *rl, int level)
+print_routes(const struct route_lis= t *rl, msglvl_t msglevel)

{
struct ro= ute_ipv4 *r;
for (r =3D rl->routes; r; r =3D r->= next)
{
- print_route(r, level);
+ print_route(r, msglevel);
}<= /span>
}

@@ -3059,18 +3059,18 @= @
* Show current routing table
*/
void
-show_= routes(int msglev)
+s= how_routes(msglvl_t msglevel)
{
struc= t gc_arena gc =3D gc_new();

const MI= B_IPFORWARDTABLE *rt =3D get_windows_routing_table(&gc);

- msg(msglev, &q= uot;SYSTEM ROUTING TABLE");
+ msg(msglevel, "SYSTEM ROUTING TABLE"); if (rt)
{
for (DW= ORD i =3D 0; i < rt->dwNumEntries; ++i)
{
- msg(msglev, = "%s", format_route_entry(&rt->table[i], &gc));<= br>+ msg(msglevel, &= quot;%s", format_route_entry(&rt->table[i], &gc)); }
}
gc_free(&= ;gc);
diff --git a/src/openvpn/route.h b/src/openvpn/route.= h
index 9b6a47e..c5006ae 100644
--- a/src/o= penvpn/route.h
+++ b/src/openvpn/route.h
@@= -356,7 +356,7 @@
void get_default_gateway_ipv6(struct rou= te_ipv6_gateway_info *rgi, const struct in6_addr *dest,
= openvpn_net_ctx_t *ctx);

-void print_default_gateway= (const int msglevel, const struct route_gateway_info *rgi,
+void print_default_gateway(const msg= lvl_t msglevel, const struct route_gateway_info *rgi,
= const struct route_ipv6_gateway_info *rgi6);<= br>
/*
@@ -371,15 +371,15 @@=
int test_local_addr(const in_addr_t addr, const struct route_gat= eway_info *rgi);

#ifndef ENABLE_SMALL
-void print_route_options= (const struct route_option_list *rol, int level);
+void print_route_options(const struct route_o= ption_list *rol, msglvl_t msglevel);

#en= dif

-= void print_routes(const struct route_list *rl, int level);
+void print_routes(const struct route= _list *rl, msglvl_t msglevel);

#ifdef _W= IN32

= -void show_routes(int msglev);
+void show_routes(msglvl_t msglevel);
bool test_routes(const struct route_list *rl, const struct tuntap *= tt);

diff --git a/src/openvpn/run_command= .c b/src/openvpn/run_command.c
index 4a1ef22..a0c9484 10064= 4
--- a/src/openvpn/run_command.c
+++ b/src= /openvpn/run_command.c
@@ -107,7 +107,7 @@
=
#ifndef WIN32
bool
-openvpn_waitpid_check(pid_t pid, const cha= r *msg_prefix, int msglevel)
+openvpn_waitpid_check(pid_t pid, const char *msg_prefix, msglvl_t = msglevel)
{
if (pid =3D=3D 0)<= br> {
diff --git a/src/openvpn/run_command.h b/sr= c/openvpn/run_command.h
index afd1b88..234055e 100644
--- a/src/openvpn/run_command.h
+++ b/src/openvp= n/run_command.h
@@ -71,13 +71,13 @@
* Thi= s function is currently not implemented for Windows as the helper * macros used by this function are not available.
= *
- * @param pid = pid of the process to be checked
+ * @param pid pid of the process to be ch= ecked
* @param msg_prefix prefixed of the message tha= t be printed
- * @param= msglevel msglevel of the messages to be printed
- * @return true if the= process is still running, false if
- * an error condition occurred
+ * @param msglevel = msglevel of the messages to be printed
+ * @return true if the process is still ru= nning, false if
+ * = an error condition occurred
*/
-bool openvpn_waitpid_check(= pid_t pid, const char *msg_prefix, int msglevel);
+bool openvpn_waitpid_check(pid_t pid, const c= har *msg_prefix, msglvl_t msglevel);

#en= dif

diff --git a/src/openvpn/sig.c b/src/= openvpn/sig.c
index ecea635..42ad823 100644
--- a/src/openvpn/sig.c

+++ b/src/openvpn/sig.c
= @@ -287,7 +287,7 @@
}

void

-print_signal= (const struct signal_info *si, const char *title, int msglevel)
<= span style=3D"color: hsl(120, 100%, 40%);">+print_signal(const struct signa= l_info *si, const char *title, msglvl_t msglevel)

{=
if (si)
{
diff --git a/= src/openvpn/sig.h b/src/openvpn/sig.h
index 7e5dd9f..b5d81f= c 100644
--- a/src/openvpn/sig.h
+++ b/src/= openvpn/sig.h
@@ -66,7 +66,7 @@
void restore_signal_state(void);

-void print_signal(const struct signal_= info *si, const char *title, int msglevel);
+void print_signal(const struct signal_info *si, con= st char *title, msglvl_t msglevel);

void= print_status(struct context *c, struct status_output *so);

diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c=
index 306170c..eeb42d1 100644
--- a/src/op= envpn/socket.c
+++ b/src/openvpn/socket.c
@= @ -78,7 +78,7 @@
static int
get_addr_gene= ric(sa_family_t af, unsigned int flags, const char *hostname, void *network= ,
unsigned int *netbits, int resolve_retr= y_seconds, struct signal_info *sig_info,
- int msglevel)
+ msglvl_t msglevel) {
char *endp, *sep, *var_host =3D NULL;=
struct addrinfo *ai =3D NULL;
@@ -211,7 +211= ,8 @@
}

bool
= -get_ipv6_addr(const char *hostna= me, struct in6_addr *network, unsigned int *netbits, int msglevel)+get_ipv6_addr(const char *ho= stname, struct in6_addr *network, unsigned int *netbits,
+ msglvl_t msglevel)
{
if (get_addr_generic(AF_INET6, GETADDR_R= ESOLVE, hostname, network, netbits, 0, NULL, msglevel)
= < 0)
@@ -1516,7 +1517,7 @@
linksoc= k_print_addr(struct link_socket *sock)
{
= struct gc_arena gc =3D gc_new();
- const int msglevel =3D (sock->mode =3D=3D LS_MODE_TCP= _ACCEPT_FROM) ? D_INIT_MEDIUM : M_INFO;
+ const msglvl_t msglevel =3D (sock->mode =3D=3D L= S_MODE_TCP_ACCEPT_FROM) ? D_INIT_MEDIUM : M_INFO;
<= br> /* print local address */
if (sock->b= ind_local)
diff --git a/src/openvpn/socket_util.c b/src/ope= nvpn/socket_util.c
index 9b7312d..fa566e7 100644
= --- a/src/openvpn/socket_util.c
+++ b/src/openvpn/soc= ket_util.c
@@ -541,7 +541,7 @@
struct = addrinfo hints;
int status;
struc= t signal_info sigrec =3D { 0 };
- int msglevel =3D (flags & GETADDR_FATAL) ? M_FATAL : D_RE= SOLVE_ERRORS;
+ ms= glvl_t msglevel =3D (flags & GETADDR_FATAL) ? M_FATAL : D_RESOLVE_ERROR= S;
struct gc_arena gc =3D gc_new();
= const char *print_hostname;
const char *print_servn= ame;
@@ -604,7 +604,7 @@
int resol= ve_retries =3D
(flags & GETADDR_TRY_ONCE) = ? 1 : ((resolve_retry_seconds + 4) / fail_wait_interval);
= const char *fmt;
+ msglvl_t level =3D 0;

= /* this is not a numeric IP, therefore force resolution using the
* provided ai_family */
@@ -739,7 +7= 39,7 @@
done:
if (sig_info &&= sig_info->signal_received)
{
- int level =3D 0;
+ msglvl_t level =3D 0; if (flags & GETADDR_FATAL_ON_SIGNAL)
= {
level =3D M_FATAL;
d= iff --git a/src/openvpn/socket_util.h b/src/openvpn/socket_util.hindex 361edff..ada52a4 100644
--- a/src/openvpn/sock= et_util.h
+++ b/src/openvpn/socket_util.h
@= @ -142,7 +142,7 @@
* Translate an IPv6 addr or hostname f= rom string form to in6_addr
*/
bool get_= ipv6_addr(const char *hostname, struct in6_addr *network, unsigned int *net= bits,
- = int msglevel);
+ = msglvl_t msglevel);

int= openvpn_getaddrinfo(unsigned int flags, const char *hostname, const char *= servname,
int resolve_retry_second= s, struct signal_info *sig_info, int ai_family,
diff --git = a/src/openvpn/ssl_verify_backend.h b/src/openvpn/ssl_verify_backend.h
index a0559c9..2bad3eb 100644
--- a/src/openvpn/= ssl_verify_backend.h
+++ b/src/openvpn/ssl_verify_backend.h=
@@ -193,8 +193,8 @@
* @param gc = Garbage collection arena for temp data
*
*/

-void x509_trac= k_add(const struct x509_track **ll_head, const char *name, int msglevel,
- stru= ct gc_arena *gc);
+vo= id x509_track_add(const struct x509_track **ll_head, const char *name,
+ msgl= vl_t msglevel, struct gc_arena *gc);

/*<= /span>
* Save X509 fields to environment, using the naming conve= ntion:
diff --git a/src/openvpn/ssl_verify_mbedtls.c b/src/= openvpn/ssl_verify_mbedtls.c
index cfcfb25..3588071 100644<= /span>
--- a/src/openvpn/ssl_verify_mbedtls.c
+++ = b/src/openvpn/ssl_verify_mbedtls.c
@@ -350,7 +350,7 @@
}

void
-x509_track_add(const struct x509_track **l= l_head, const char *name, int msglevel,
+x509_track_add(const struct x509_track **ll_head, const= char *name, msglvl_t msglevel,
struct gc_a= rena *gc)
{
struct x509_track *xt;
diff --git a/src/openvpn/ssl_verify_openssl.c b/src/openvpn/s= sl_verify_openssl.c
index 6de7e2a..0f257e2 100644--- a/src/openvpn/ssl_verify_openssl.c
+++ b/src/ope= nvpn/ssl_verify_openssl.c
@@ -414,7 +414,7 @@
*/


void
-x509_track_add(const struct x509_track **ll_head,= const char *name, int msglevel,
+x509_track_add(const struct x509_track **ll_head, const char *= name, msglvl_t msglevel,
struct gc_arena *g= c)
{
struct x509_track *xt;diff --git a/src/openvpn/status.c b/src/openvpn/status.c
<= span>index 34e5a2f..cea31f5 100644

--- a/src/openvpn/status= .c
+++ b/src/openvpn/status.c
@@ -230,14 +2= 30,13 @@

if (so->msglevel >= ;=3D 0 && !so->errors)
{
- msg(so->msglevel, &qu= ot;%s", buf);

+ = msg((msglvl_t)so->msglevel, "%s", buf);
<= span> }


if (so->fd &g= t;=3D 0 && !so->errors)
{
- int len;

strcat(buf, "\n");

- len =3D strlen(buf);
+ size_t len =3D strlen(buf);<= /span>
if (len > 0)
{=
if (write(so->fd, buf, len) !=3D len)<= /span>
diff --git a/src/openvpn/status.h b/src/openvpn/status.h
index 0c7a869..25e1663 100644
--- a/src/openv= pn/status.h
+++ b/src/openvpn/status.h
@@ -= 53,6 +53,7 @@

char *filename;=
int fd;
-static = void netsh_command(const struct argv *a, int n, int msglevel);
+static void netsh_command(const = struct argv *a, int n, msglvl_t msglevel);


-static void exec_command(const char = *prefix, const struct argv *a, int n, int msglevel);

+static void exec_command(const char *pref= ix, const struct argv *a, int n, msglvl_t msglevel);

static const char *netsh_get_id(const char *dev_node, struct g= c_arena *gc);

@@ -4001,7 +4001,7 @@
}

void
-show_tap_win_adapters(int msglev, int warnl= ev)
+show_tap_win_ada= pters(msglvl_t msglevel, msglvl_t warnlevel)
{
<= span> struct gc_arena gc =3D gc_new();


@@ -4018,7 +4018,7 @@

const struct tap_reg *tap_reg = =3D get_tap_reg(&gc);
const struct panel_reg *pane= l_reg =3D get_panel_reg(&gc);

- msg(msglev, "Available adapters [n= ame, GUID, driver]:");
+ msg(msglevel, "Available adapters [name, GUID, driver]:&qu= ot;);

/* loop through each TAP-Windo= ws adapter registry entry */
for (tr =3D tap_reg; tr != =3D NULL; tr =3D tr->next)
@@ -4030,7 +4030,7 @@<= br> {
if (!strcmp(tr->guid, p= r->guid))
{
- msg(msglev, "'%s' %s %s&= quot;, pr->name, tr->guid,
+ msg(msglevel, "'%s' %s %s", = pr->name, tr->guid,
print_tun_ba= ckend_driver(tr->windows_driver));
++li= nks;
}
@@ -4045,7 +4045,7 @@
/* a TAP adapter exists without a link from the= network
* connections control panel */
warn_panel_null =3D true;
- msg(msglev, "[NULL] %s", = tr->guid);
+ = msg(msglevel, "[NULL] %s", tr->guid);
= }
}

@@ -4064,= 18 +4064,18 @@
/* warn on registry inconsistencies */<= /span>
if (warn_tap_dup)
{
- msg(warnlev, "WARNING:= Some TAP-Windows adapters have duplicate GUIDs");

+ msg(warnlevel, "WARNING: S= ome TAP-Windows adapters have duplicate GUIDs");
= }

if (warn_panel_dup)
{

- msg(w= arnlev,
+ msg(= warnlevel,
"WARNING: Some TAP-Windows ada= pters have duplicate links from the Network Connections control panel"= );
}

if (warn_p= anel_null)
{
- msg(warnlev,
+ msg(warnlevel,
"WARN= ING: Some TAP-Windows adapters have no link from the Network Connections co= ntrol panel");
}

@@ -4805,31 +4805,31 @@

* Show info for a single adapte= r
*/
static void
-show_adapter(int msglev, const IP_ADAPTER_I= NFO *a, struct gc_arena *gc)
+show_adapter(msglvl_t msglevel, const IP_ADAPTER_INFO *a, struct g= c_arena *gc)
{
- msg(msglev, "%s", a->Description);
- msg(msglev, " Index =3D %= d", (int)a->Index);

- msg(msglev, " GUID =3D %s", a->AdapterName);=
- msg(msglev, " IP = =3D %s", format_ip_addr_string(&a->IpAddressList, gc));<= br>- msg(msglev, " MAC = =3D %s", format_hex_ex(a->Address, a->AddressLength, 0, 1, "= ;:", gc));
- ms= g(msglev, " GATEWAY =3D %s", format_ip_addr_string(&a->Ga= tewayList, gc));
+ = msg(msglevel, "%s", a->Description);
+ msg(msglevel, " Index =3D %d"= , (int)a->Index);
= + msg(msglevel, " GUID =3D %s", a->AdapterName);+ msg(msglevel, " IP = =3D %s", format_ip_addr_string(&a->IpAddressList, gc));<= br>+ msg(msglevel, " M= AC =3D %s", format_hex_ex(a->Address, a->AddressLength, 0, 1, &q= uot;:", gc));
+ = msg(msglevel, " GATEWAY =3D %s", format_ip_addr_string(&a= ->GatewayList, gc));
if (a->DhcpEnabled)<= br> {
- = msg(msglev, " DHCP SERV =3D %s", format_ip_addr_string(&a-= >DhcpServer, gc));
-= msg(msglev, " DHCP LEASE OBTAINED =3D %s", time_string(a= ->LeaseObtained, 0, false, gc));
- msg(msglev, " DHCP LEASE EXPIRES =3D %s",= time_string(a->LeaseExpires, 0, false, gc));
+ msg(msglevel, " DHCP SERV =3D %s= ", format_ip_addr_string(&a->DhcpServer, gc));
+ msg(msglevel, " DHCP L= EASE OBTAINED =3D %s", time_string(a->LeaseObtained, 0, false, gc))= ;
+ msg(msglev= el, " DHCP LEASE EXPIRES =3D %s", time_string(a->LeaseExpire= s, 0, false, gc));
}
if (a->Ha= veWins)
{
- msg(msglev, " PRI WINS =3D %s", format_ip_addr_= string(&a->PrimaryWinsServer, gc));
- msg(msglev, " SEC WINS =3D %s", for= mat_ip_addr_string(&a->SecondaryWinsServer, gc));
+ msg(msglevel, " PRI WINS= =3D %s", format_ip_addr_string(&a->PrimaryWinsServer, gc));
+ msg(msglevel, = " SEC WINS =3D %s", format_ip_addr_string(&a->SecondaryWi= nsServer, gc));
}

= {
const IP_PER_ADAPTER_INFO *pai =3D get_per_ad= apter_info(a->Index, gc);
if (pai)
{

- = msg(msglev, " DNS SERV =3D %s", format_ip_addr_string(&= pai->DnsServerList, gc));
+ msg(msglevel, " DNS SERV =3D %s", format_ip= _addr_string(&pai->DnsServerList, gc));
}
}
}
@@ -4838,12 +4838,= 12 @@
* Show current adapter list
*/
void
-sh= ow_adapters(int msglev)
+show_adapters(msglvl_t msglevel)
{
= struct gc_arena gc =3D gc_new();
const IP_ADAPTER_IN= FO *ai =3D get_adapter_info_list(&gc);

- msg(msglev, "SYSTEM ADAPTER= LIST");

+ ms= g(msglevel, "SYSTEM ADAPTER LIST");
if (ai)<= /span>
{
const IP_ADAPTER_INFO *a;
@@ -4851,7 +4851,7 @@
/* find index= in the linked list */
for (a =3D ai; a !=3D NULL;= a =3D a->Next)
{
- show_adapter(msglev, a, &gc);
+ show_adapter(= msglevel, a, &gc);
}
}
gc_free(&gc);
@@ -5048,7 +5048,7 @@<= /span>
}

static void-exec_command(const char *prefix= , const struct argv *a, int n, int msglevel)
+exec_command(const char *prefix, const struct argv= *a, int n, msglvl_t msglevel)
{
int = i;
for (i =3D 0; i < n; ++i)
@@ -50= 69,7 +5069,7 @@
}

stati= c void
-netsh_command(c= onst struct argv *a, int n, int msglevel)
+netsh_command(const struct argv *a, int n, msglvl_t m= sglevel)
{
exec_command("NETSH&q= uot;, a, n, msglevel);
}
diff --git a/src/= openvpn/tun.h b/src/openvpn/tun.h
index 06fc729..6562c22 10= 0644
--- a/src/openvpn/tun.h
+++ b/src/open= vpn/tun.h
@@ -445,9 +445,9 @@
DWORD adapte= r_index_of_ip(const IP_ADAPTER_INFO *list, const in_addr_t ip, int *count,<= /span>
in_addr_t *netmask);
<= span>

-void show_tap_w= in_adapters(int msglev, int warnlev);
+void show_tap_win_adapters(msglvl_t msglevel, msglvl_t wa= rnlevel);

-void show_adapters(int msglev);
+void show_adapters(msglvl_t msglevel);
<= /span>
void tap_allow_nonadmin_access(const char *dev_node);

diff --git a/tests/unit_tests/openvpn/mock_ms= g.c b/tests/unit_tests/openvpn/mock_msg.c
index 603520b..69= d2d1d 100644
--- a/tests/unit_tests/openvpn/mock_msg.c
+++ b/tests/unit_tests/openvpn/mock_msg.c
@@ -3= 8,8 +38,8 @@
#include "error.h"
= #include "mock_msg.h"

-unsigned int x_debug_level =3D 0; /* Default t= o (almost) no debugging output */
-unsigned int print_x_debug_level =3D 0;
+msglvl_t x_debug_level =3D 0; /* Default = to (almost) no debugging output */
+msglvl_t print_x_debug_level =3D 0;
=
bool fatal_error_triggered =3D false;
@@ -47,31 +47,31 @@


<= span> void

-mock_set_de= bug_level(int level)
= +mock_set_debug_level(msglvl_t level)
{
= x_debug_level =3D level;
}

= -int
+msglvl_t
mock_get_debug_level(v= oid)
{
return x_debug_level; }

void
-mock_set_print_debug_level(int level)+mock_set_print_debug_level(m= sglvl_t level)
{
print_x_debug_level = =3D level;
}

-int
+msglvl_t
get_debug_level(void)
= {
return x_debug_level;
}
<= span>

void
-x_msg_va(const unsigned int flags, const char *format, va_list argli= st)
+x_msg_va(const m= sglvl_t flags, const char *format, va_list arglist)
{
if (flags & M_FATAL)
{
= @@ -89,7 +89,7 @@
}

void

-x_msg(const un= signed int flags, const char *format, ...)
+x_msg(const msglvl_t flags, const char *format, ...)=
{
va_list arglist;
= va_start(arglist, format);
@@ -128,7 +128,7 @@ }

bool
-dont_mute(unsigned int flags)
+dont_mute(msglvl_t flags)
= {
return true;
}
diff --git a/tests/unit_tests/openvpn/mock_msg.h b/tests/unit_tests/open= vpn/mock_msg.h

index f4ebc23..6dddf0b 100644
--- a/tests/unit_tests/openvpn/mock_msg.h

+++ b/tests/uni= t_tests/openvpn/mock_msg.h
@@ -28,17 +28,15 @@
* this function from your test driver to increase debug output when y= ou

* need debug output.
*/
-void mock_set_debug_level(int leve= l);

+void mock_set_de= bug_level(msglvl_t level);

#define MOCK_= MSG_BUF 2048

extern bool fatal_error_tri= ggered;
extern char mock_msg_buf[MOCK_MSG_BUF];
=
-void mock_set_= debug_level(int level);
+msglvl_t mock_get_debug_level(void);

-int mock_get_debug_level(void);=
-
-void mock_set_print_debug_level(int level);
+void mock_set_print_debug= _level(msglvl_t level);

#endif /* MOCK_M= SG */
diff --git a/tests/unit_tests/openvpn/mock_ssl_depend= encies.c b/tests/unit_tests/openvpn/mock_ssl_dependencies.c
index 7333c47..f2fa93a 100644

--- a/tests/unit_tests/openv= pn/mock_ssl_dependencies.c
+++ b/tests/unit_tests/openvpn/m= ock_ssl_dependencies.c
@@ -38,7 +38,7 @@
<= /span>
int
parse_line(const char *line, char **p= , const int n, const char *file, const int line_num,
- int msglevel, struct gc_arena *g= c)
+ msglvl= _t msglevel, struct gc_arena *gc)
{
/= * Dummy function to get the linker happy, should never be called */<= br> assert_true(false);
diff --git a/tests/unit_t= ests/openvpn/test_argv.c b/tests/unit_tests/openvpn/test_argv.c
<= span>index a65857b..a04fabc 100644

--- a/tests/unit_tests/o= penvpn/test_argv.c
+++ b/tests/unit_tests/openvpn/test_argv= .c
@@ -23,7 +23,7 @@

int=
__wrap_parse_line(const char *line, char **p, const int n= , const char *file, const int line_num,
- int msglevel, struct gc_arena *gc)
+ msglvl= _t msglevel, struct gc_arena *gc)
{
p= [0] =3D PATH1 PATH2;
p[1] =3D PARAM1;
= diff --git a/tests/unit_tests/openvpn/test_misc.c b/tests/unit_tests/openvp= n/test_misc.c
index 93e2460..dbfdd56 100644
--- a/tests/unit_tests/openvpn/test_misc.c

+++ b/tests/uni= t_tests/openvpn/test_misc.c
@@ -339,8 +339,8 @@
<= span> assert_false(valid_integer("-2147483653", false));


- int msglevel =3D D_LOW;
- int saved_log_level =3D mock_get_debug_level();<= br>+ msglvl_t msglevel =3D D= _LOW;
+ msglvl_t s= aved_log_level =3D mock_get_debug_level();
mock_set_de= bug_level(D_LOW);

/* check happy pat= h */
diff --git a/tests/unit_tests/openvpn/test_pkcs11.c b/= tests/unit_tests/openvpn/test_pkcs11.c
index 9ba6cfc..d5688= 65 100644
--- a/tests/unit_tests/openvpn/test_pkcs11.c
+++ b/tests/unit_tests/openvpn/test_pkcs11.c
@@= -59,7 +59,7 @@
/* stubs for some unused functions instead= of pulling in too many dependencies */
int
parse_line(const char *line, char **p, const int n, const char *file, co= nst int line_num,

- = int msglevel, struct gc_arena *gc)
+ msglvl_t msglevel, struct gc_arena *gc)
{
assert_true(0);
= return 0;
diff --git a/tests/unit_tests/openvpn/test_pkt.c = b/tests/unit_tests/openvpn/test_pkt.c
index 5122766..b6c612= b 100644
--- a/tests/unit_tests/openvpn/test_pkt.c+++ b/tests/unit_tests/openvpn/test_pkt.c
@@ -45,7 = +45,7 @@

int
parse_line= (const char *line, char **p, const int n, const char *file, const int line_= num,
- int ms= glevel, struct gc_arena *gc)
+ msglvl_t msglevel, struct gc_arena *gc)
{

/* Dummy function to get the linker happy, should = never be called */
assert_true(false);
diff --git a/tests/unit_tests/openvpn/test_push_update_msg.c b/tests/unit_= tests/openvpn/test_push_update_msg.c

index 87329b1..8a5beeb= 100644
--- a/tests/unit_tests/openvpn/test_push_update_msg= .c
+++ b/tests/unit_tests/openvpn/test_push_update_msg.c
@@ -111,7 +111,7 @@

#ifnde= f ENABLE_MANAGEMENT
bool
-send_control_channel_string(struct context *c, const ch= ar *str, int msglevel)
-send_control_channel_string(struct context *c, const char *str, = int msglevel)
+send_c= ontrol_channel_string(struct context *c, const char *str, msglvl_t msglevel= )
{
if (res && res[i] &&a= mp; strcmp(res[i], str))
{
diff --git = a/tests/unit_tests/openvpn/test_socket.c b/tests/unit_tests/openvpn/test_so= cket.c
index 2da2529..7f740ac 100644
--- a/= tests/unit_tests/openvpn/test_socket.c
+++ b/tests/unit_tes= ts/openvpn/test_socket.c
@@ -59,7 +59,7 @@
=
int
parse_line(const char *line, char *= *p, const int n, const char *file, const int line_num,
- int msglevel, struct gc_arena *= gc)
+ msglv= l_t msglevel, struct gc_arena *gc)
{
= assert_true(0);
return 0;
diff --git a= /tests/unit_tests/openvpn/test_tls_crypt.c b/tests/unit_tests/openvpn/test_= tls_crypt.c
index 532bfcd..44d51fe 100644
-= -- a/tests/unit_tests/openvpn/test_tls_crypt.c
+++ b/tests/= unit_tests/openvpn/test_tls_crypt.c
@@ -98,7 +98,7 @@

int
__wrap_parse_line(const = char *line, char **p, const int n, const char *file, const int line_num,
- int ms= glevel, struct gc_arena *gc)
+ msglvl_t msglevel, struct gc_arena *gc) {
p[0] =3D PATH1 PATH2;
= p[1] =3D PARAM1;
diff --git a/tests/unit_tests/openvpn/test= _user_pass.c b/tests/unit_tests/openvpn/test_user_pass.c
in= dex 460b37f..32ec59f 100644
--- a/tests/unit_tests/openvpn/= test_user_pass.c
+++ b/tests/unit_tests/openvpn/test_user_p= ass.c
@@ -73,7 +73,7 @@
/* stubs for some = unused functions instead of pulling in too many dependencies */
<= span> int

parse_line(const char *line, char **p, const int= n, const char *file, const int line_num,
- int msglevel, struct gc_arena *gc)+ msglvl_t msglevel,= struct gc_arena *gc)
{
assert_true(0= );
return 0;

To vi= ew, visit change 1110. To unsubscribe, or for help writing mail filters, visit = settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id492cb774c6d022d06bb3cf5fec= 2a4bdd410e619
Gerrit-Change-Number: 1110
Gerrit-PatchSet: 17
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: ordex <antonio@...2726...&= gt;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--1VllKtja4lk=--