Add logging API for plug-ins
cover Add logging API for plug-ins
After some discussion on IRC, here's the mini patch series for adding a logging API for plug-ins.
Changes from the previous patch:
* split the changes to error.[ch] into separate patch
* add a mandatory prefix "PLUGIN <name>: " to each log line
* never log the instance prefix as it's not thread safe to do so
* fixed comment for plugin_log() in header file
Heiko Hund (2):
add x_msg_va() log function
add plugin_log() API to write to openvpn log
include/openvpn-plugin.h | 23 +++++++++++++++++++++ src/openvpn/error.c | 11 +++++++--- src/openvpn/error.h | 2 ++ src/openvpn/plugin.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/2 add x_msg_va() log function
This change allows other functions to access the functionality in x_msg(). Needed for the plug-in logging API.
--- src/openvpn/error.c | 11 ++++++++--- src/openvpn/error.h | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-)
src/openvpn/error.c +8 -3
@@ -201,8 +201,15 @@ int x_msg_line_num; /* GLOBAL */void x_msg (const unsigned int flags,const char *format, ...) { -struct gc_arena gc;va_list arglist; +va_start (arglist, format); +x_msg_va (flags, format, arglist); +va_end (arglist); +} + +void x_msg_va (const unsigned int flags,const char *format,va_list arglist) +{ +struct gc_arena gc;#if SYSLOG_CAPABILITY int level;#endif
@@ -237,9 +244,7 @@ void x_msg (const unsigned int flags, const char *format, ...) m1 = (char *)gc_malloc (ERR_BUF_SIZE , false, &gc); m2 = (char *)gc_malloc (ERR_BUF_SIZE , false, &gc); -va_start (arglist, format);vsnprintf (m1,ERR_BUF_SIZE , format, arglist); -va_end (arglist); m1[ERR_BUF_SIZE -1 ] =0 ;/* windows vsnprintf needs this */ if ((flags &M_ERRNO ) && e)
src/openvpn/error.h +2 -0
@@ -182,6 +182,8 @@ void x_msg (const unsigned int flags, const char *format, ...)#endif ;/* should be called via msg above */ +void x_msg_va (const unsigned int flags,const char *format,va_list arglist); +/* * Function prototypes */
Signature · 1 line
1.7.9.5
Re: [Openvpn-devel] [PATCH 1/2] add x_msg_va() log function
Quoted 9 lines · Heiko Hund
This change allows other functions to access the functionality in
x_msg(). Needed for the plug-in logging API.Signed-off-by Heiko Hund <[email protected]...>--- src/openvpn/error.c | 11 ++++++++--- src/openvpn/error.h | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-)
ACK. Applied to master.
commit 004ca97c9427841cc240f954d7594416cd249187
Author: Heiko Hund <[email protected]...> Date: Wed Aug 1 13:37:37 2012 +0200
add x_msg_va() log function
Signed-off-by: Heiko Hund <[email protected]...>
Acked-by: David Sommerseth <[email protected]...>
Message-Id: [email protected]...
URL: http://article.gmane.org/gmane.network.openvpn.devel/6923
Signed-off-by: David Sommerseth <[email protected]...>kind regards,
David Sommerseth
PATCH 2/2 add plugin_log() API to write to openvpn log
In reply to Heiko HundSome plugins want to add messages to the openvpn log file. The plugin_log() API provides a way for them to do so.
--- include/openvpn-plugin.h | 23 +++++++++++++++++++++ src/openvpn/plugin.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+)
include/openvpn-plugin.h +23 -0
@@ -47,6 +47,29 @@ typedef X509 openvpn_x509_cert_t;extern "C" {#endif +/** +* plugin_log() - plug-in log function. +* +* Use this function to add information to the OpenVPN log file. +* Messages will only be displayed if the plugin_name parameter is set. +* Debug messages will only be displayed with plug-in debug log verbosity. +* +*/ +typedef enum +{ +PLOG_ERR = (1 <<0 ),/* Error condition message */ +PLOG_WARN = (1 <<1 ),/* General warning message */ +PLOG_NOTE = (1 <<2 ),/* Informational message */ +PLOG_DEBUG = (1 <<3 ),/* Debug message, displayed if verb >= 7 */ + +PLOG_ERRNO = (1 <<8 ),/* Add error description to message */ +PLOG_NOMUTE = (1 <<9 ),/* Mute setting does not apply for message */ + +}openvpn_plugin_log_flags_t ; + +plugin_log (openvpn_plugin_log_flags_t flags, const char *plugin_name, const char *format, ...); + +/* * Plug-in types. These types correspond to the set of script callbacks * supported by OpenVPN.
src/openvpn/plugin.c +51 -0
57 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 2/2 add plugin_log() API to write to openvpn log
Some plugins want to add messages to the openvpn log file. The plugin_log() API provides a way for them to do so.
--- include/openvpn-plugin.h | 23 +++++++++++++++++++++ src/openvpn/plugin.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+)
include/openvpn-plugin.h +23 -0
@@ -47,6 +47,29 @@ typedef X509 openvpn_x509_cert_t;extern "C" {#endif +/** +* plugin_log() - plug-in log function. +* +* Use this function to add information to the OpenVPN log file. +* Messages will only be displayed if the plugin_name parameter is set. +* Debug messages will only be displayed with plug-in debug log verbosity. +* +*/ +typedef enum +{ +PLOG_ERR = (1 <<0 ),/* Error condition message */ +PLOG_WARN = (1 <<1 ),/* General warning message */ +PLOG_NOTE = (1 <<2 ),/* Informational message */ +PLOG_DEBUG = (1 <<3 ),/* Debug message, displayed if verb >= 7 */ + +PLOG_ERRNO = (1 <<8 ),/* Add error description to message */ +PLOG_NOMUTE = (1 <<9 ),/* Mute setting does not apply for message */ + +}openvpn_plugin_log_flags_t ; + +void plugin_log (openvpn_plugin_log_flags_t flags,const char *plugin_name,const char *format, ...); + +/* * Plug-in types. These types correspond to the set of script callbacks * supported by OpenVPN.
src/openvpn/plugin.c +51 -0
57 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [Openvpn-devel] [PATCH 2/2 fixed] add plugin_log() API to write to openvpn log
How will it work on Windows?
Plugins should not require to be linked against anything.
Quoted 119 lines · Heiko Hund
Some plugins want to add messages to the openvpn log file. The
plugin_log()API provides a way for them to do so.Signed-off-by Heiko Hund <[email protected]...>--- include/openvpn-plugin.h | 23 +++++++++++++++++++++ src/openvpn/plugin.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+)include/openvpn-plugin.h +23
-0@@ -47,6 +47,29 @@ typedef X509 openvpn_x509_cert_t;extern "C" {#endif +/** +* plugin_log() - plug-in log function. +* +* Use this function to add information to the OpenVPN log file. +* Messages will only be displayed if the plugin_name parameter is set. +* Debug messages will only be displayed with plug-in debug log verbosity. +* +*/ +typedef enum +{ +PLOG_ERR = (1 <<0 ),/* Error condition message */ +PLOG_WARN = (1 <<1 ),/* General warning message */ +PLOG_NOTE = (1 <<2 ),/* Informational message */ +PLOG_DEBUG = (1 <<3 ),/* Debug message, displayed if verb >= 7 */ + +PLOG_ERRNO = (1 <<8 ),/* Add error description to message */ +PLOG_NOMUTE = (1 <<9 ),/* Mute setting does not apply for message */ + +}openvpn_plugin_log_flags_t ; + +void plugin_log (openvpn_plugin_log_flags_t flags,const char *plugin_name,const char *format, ...); + +/* * Plug-in types. These types correspond to the set of script callbacks * supported by OpenVPN. src/openvpn/plugin.c +51
-1@@ -286,6 +286,57 @@ plugin_init_item (struct plugin *p, const struct plugin_option *o)gc_free (&gc); } + +void +plugin_log (openvpn_plugin_log_flags_t flags,const char *name,const char *format, ...) +{ +unsigned int msg_flags; + +if (!format) +return ; + +if (!name || name[0 ] =='\0' ) + { +msg (D_PLUGIN_DEBUG ,"PLUGIN: suppressed log message from plugin with unknown name" ); +return ; + } + +if (flags &PLOG_ERR ) + msg_flags =M_INFO |M_NONFATAL ; +else if (flags &PLOG_WARN ) + msg_flags =M_INFO |M_WARN ; +else if (flags &PLOG_NOTE ) + msg_flags =M_INFO ; +else if (flags &PLOG_DEBUG ) + msg_flags =D_PLUGIN_DEBUG ; + +if (flags &PLOG_ERRNO ) + msg_flags |=M_ERRNO ; +if (flags &PLOG_NOMUTE ) + msg_flags |=M_NOMUTE ; + +if (MSG_TEST (msg_flags)) + { +struct gc_arena gc; +va_list arglist; +char * msg_fmt; + +/* Never add instance prefix; not thread safe */ + msg_flags |=M_NOIPREFIX ; + +gc_init (&gc); + msg_fmt =gc_malloc (ERR_BUF_SIZE , false, &gc); +openvpn_snprintf (msg_fmt,ERR_BUF_SIZE ,"PLUGIN %s: %s" , name, format); + +va_start (arglist, format); +x_msg_va (msg_flags, msg_fmt, arglist); +va_end (arglist); + +gc_free (&gc); + } +} + + static void plugin_open_item (struct plugin *p, const struct plugin_option *o, --1.7.9.5
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Re: [Openvpn-devel] [PATCH 2/2 fixed] add plugin_log() API to write to openvpn log
Quoted 1 line · On Wednesday 01 August 2012 15:27:01 Alon Bar-Lev wrote:
How will it work on Windows?
Good question. Can't it work on Windows? According to objdump openvpn.exe exports all the symbols statically on Windows. Is that a limitation of the PE format?
If not, the alternative would be to pass the function pointer in one (all?) of the v3 plug-in structs.
Heiko
Signature · 2 lines
Heiko Hund | Sr. Software Engineer | Tel +49-721-25516-237 | Fax -200 SOPHOS NSG | Amalienbadstr. 41 Bau 52 | 76227 Karlsruhe | Germany
Re: [Openvpn-devel] [PATCH 2/2 fixed] add plugin_log() API to write to openvpn log
Quoted 9 lines · Heiko Hund
Quoted 1 line · On Wednesday 01 August 2012 15:27:01 Alon Bar-Lev wrote:
How will it work on Windows?
Good question. Can't it work on Windows? According to objdump openvpn.exe exports all the symbols statically on Windows. Is that a limitation of the PE format?
If not, the alternative would be to pass the function pointer in one (all?) of the v3 plug-in structs.
Must use the callback struct.
Alon
PATCH 2/2 add plugin_log() API to write to openvpn log
In reply to Heiko HundSome plugins want to add messages to the openvpn log file. The plugin_log() API provides a way for them to do so.
---
This is the first variant of PATCH 2/2 that deals with the fact that the original plugin_log() approach was not working on Windows.
It uses an inline function on Windows which explicitly resolves the symbol needed to log from plug-ins, as the dynamic linker fails to do so. OpenVPN exports the plugin_log_va() function for use by plug-ins.
Pros:
+ simple to use, just call plugin_log() in you plug-in code
+ available to any plug-in regradless of its API version
Cons:
- looks a bit messy with all the preprocessor stuff in place
- multiple symbol look-ups when including openvpn-plugin.h in two+ files
include/openvpn-plugin.h | 48 ++++++++++++++++++++++++++++++++++++++- src/openvpn/plugin.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 1 deletion(-)
include/openvpn-plugin.h +47 -1
@@ -47,6 +47,52 @@ typedef X509 openvpn_x509_cert_t;extern "C" {#endif +/** +* plugin_log() - plug-in log function. +* +* Use this function to add information to the OpenVPN log file. +* Messages will only be displayed if the plugin_name parameter is set. +* Debug messages will only be displayed with plug-in debug log verbosity. +* +*/ +typedef enum +{ +PLOG_ERR = (1 <<0 ),/* Error condition message */ +PLOG_WARN = (1 <<1 ),/* General warning message */ +PLOG_NOTE = (1 <<2 ),/* Informational message */ +PLOG_DEBUG = (1 <<3 ),/* Debug message, displayed if verb >= 7 */ + +PLOG_ERRNO = (1 <<8 ),/* Add error description to message */ +PLOG_NOMUTE = (1 <<9 ),/* Mute setting does not apply for message */ + +}openvpn_plugin_log_flags_t ; + +#if defined(WIN32 ) +#include <windows.h> +#include <stdarg.h> + +static inline void +plugin_log (openvpn_plugin_log_flags_t flags,const char *plugin_name,const char *format, ...) +{ +typedef void (*log_fn_t )(openvpn_plugin_log_flags_t ,const char *,const char *,va_list ); +static log_fn_t log =NULL ; +if (log ==NULL ) + { + log = (log_fn_t )GetProcAddress (GetModuleHandle (NULL ),"plugin_log_va" ); +if (log ==NULL ) +return ; + } + +va_list arglist; +va_start (arglist, format); +log (flags, plugin_name, format, arglist); +va_end (arglist); +} +#else +void plugin_log (openvpn_plugin_log_flags_t flags,const char *plugin_name,const char *format, ...); +#endif + +/* * Plug-in types. These types correspond to the set of script callbacks * supported by OpenVPN.
@@ -145,7 +191,7 @@ typedef void *openvpn_plugin_handle_t;/* * For Windows (needs to be modified for MSVC) */ -#if defined(__MINGW32_VERSION) && !defined(OPENVPN_PLUGIN_H ) +#if defined(WIN32 )# define OPENVPN_EXPORT __declspec(dllexport)#else # define OPENVPN_EXPORT
src/openvpn/plugin.c +56 -0
62 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH 2/2 add plugin_log() API to write to openvpn log
In reply to Heiko HundSome plugins want to add messages to the openvpn log file. The plugin_log() API provides a way for them to do so.
---
This is the second variant of PATCH 2/2 that deals with the fact that the original plugin_log() approach was not working on Windows.
It passes the function pointer of plugin_log() to the plug-in's open_v3 hook.
Pros:
+ cleaner, more standard approach; less magic
+ no special treatment of Windows necessary
Cons:
- only works for plugins supporting the open_v3 API
- bit harder to use as the callback is only available inside open_v3 at first
include/openvpn-plugin.h | 25 +++++++++++++++++++++- src/openvpn/plugin.c | 52 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 2 deletions(-)
include/openvpn-plugin.h +24 -1
@@ -145,7 +145,7 @@ typedef void *openvpn_plugin_handle_t;/* * For Windows (needs to be modified for MSVC) */ -#if defined(__MINGW32_VERSION) && !defined(OPENVPN_PLUGIN_H ) +#if defined(WIN32 ) && !defined(OPENVPN_PLUGIN_H )# define OPENVPN_EXPORT __declspec(dllexport)#else # define OPENVPN_EXPORT
@@ -221,12 +221,35 @@ struct openvpn_plugin_string_list* variables in "name=value" format. Note that for security reasons, * these variables are not actually written to the "official" * environmental variable store of the process. +* +* plugin_log : a pointer to the plugin logging function. +* Use this function to add information to the OpenVPN log file. +* Messages will only be displayed if the plugin_name parameter +* is set. Debug messages will only be displayed with plug-in +* debug log verbosity. */ +typedef enum +{ +PLOG_ERR = (1 <<0 ),/* Error condition message */ +PLOG_WARN = (1 <<1 ),/* General warning message */ +PLOG_NOTE = (1 <<2 ),/* Informational message */ +PLOG_DEBUG = (1 <<3 ),/* Debug message, displayed if verb >= 7 */ + +PLOG_ERRNO = (1 <<8 ),/* Add error description to message */ +PLOG_NOMUTE = (1 <<9 ),/* Mute setting does not apply for message */ + +}openvpn_plugin_log_flags_t ; + +typedef void (*plugin_log_t ) (openvpn_plugin_log_flags_t flags, +const char *plugin_name, +const char *format, ...); +struct openvpn_plugin_args_open_in {const int type_mask;const char **const argv;const char **const envp; +plugin_log_t plugin_log; };
src/openvpn/plugin.c +51 -1
64 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Re: [Openvpn-devel] [PATCH 2/2 v2.2] add plugin_log() API to write to openvpn log
This is how it should be done, no games with symbols and linkage.
Please add printf style pragmas to the function.
Quoted 156 lines · Heiko Hund
Some plugins want to add messages to the openvpn log file. The
plugin_log()API provides a way for them to do so.Signed-off-by Heiko Hund <[email protected]...>---
This is the second variant of PATCH 2/2 that deals with the fact that the original
plugin_log()approach was not working on Windows.It passes the function pointer of
plugin_log()to the plug-in'sopen_v3hook.Pros:
+ cleaner, more standard approach; less magic
+ no special treatment of Windows necessaryCons:
- only works for plugins supporting theopen_v3API
- bit harder to use as the callback is only available insideopen_v3at firstinclude/openvpn-plugin.h | 25 +++++++++++++++++++++- src/openvpn/plugin.c | 52 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 2 deletions(-)include/openvpn-plugin.h +24
-1@@ -145,7 +145,7 @@ typedef void *openvpn_plugin_handle_t;/* * For Windows (needs to be modified for MSVC) */ -#if defined(__MINGW32_VERSION) && !defined(OPENVPN_PLUGIN_H ) +#if defined(WIN32 ) && !defined(OPENVPN_PLUGIN_H )# define OPENVPN_EXPORT __declspec(dllexport)#else # define OPENVPN_EXPORT @@ -221,12 +221,35 @@ struct openvpn_plugin_string_list* variables in "name=value" format. Note that for security reasons, * these variables are not actually written to the "official" * environmental variable store of the process. +* +* plugin_log : a pointer to the plugin logging function. +* Use this function to add information to the OpenVPN log file. +* Messages will only be displayed if the plugin_name parameter +* is set. Debug messages will only be displayed with plug-in +* debug log verbosity. */ +typedef enum +{ +PLOG_ERR = (1 <<0 ),/* Error condition message */ +PLOG_WARN = (1 <<1 ),/* General warning message */ +PLOG_NOTE = (1 <<2 ),/* Informational message */ +PLOG_DEBUG = (1 <<3 ),/* Debug message, displayed if verb >= 7 */ + +PLOG_ERRNO = (1 <<8 ),/* Add error description to message */ +PLOG_NOMUTE = (1 <<9 ),/* Mute setting does not apply for message */ + +}openvpn_plugin_log_flags_t ; + +typedef void (*plugin_log_t ) (openvpn_plugin_log_flags_t flags, +const char *plugin_name, +const char *format, ...); +struct openvpn_plugin_args_open_in {const int type_mask;const char **const argv;const char **const envp; +plugin_log_t plugin_log; };src/openvpn/plugin.c +51
-2@@ -287,6 +287,55 @@ plugin_init_item (struct plugin *p, const struct plugin_option *o) }static void +plugin_log (openvpn_plugin_log_flags_t flags,const char *name,const char *format, ...) +{ +unsigned int msg_flags; + +if (!format) +return ; + +if (!name || name[0 ] =='\0' ) + { +msg (D_PLUGIN_DEBUG ,"PLUGIN: suppressed log message from plugin with unknown name" ); +return ; + } + +if (flags &PLOG_ERR ) + msg_flags =M_INFO |M_NONFATAL ; +else if (flags &PLOG_WARN ) + msg_flags =M_INFO |M_WARN ; +else if (flags &PLOG_NOTE ) + msg_flags =M_INFO ; +else if (flags &PLOG_DEBUG ) + msg_flags =D_PLUGIN_DEBUG ; + +if (flags &PLOG_ERRNO ) + msg_flags |=M_ERRNO ; +if (flags &PLOG_NOMUTE ) + msg_flags |=M_NOMUTE ; + +if (MSG_TEST (msg_flags)) + { +struct gc_arena gc; +va_list arglist; +char * msg_fmt; + +/* Never add instance prefix; not thread safe */ + msg_flags |=M_NOIPREFIX ; + +gc_init (&gc); + msg_fmt =gc_malloc (ERR_BUF_SIZE , false, &gc); +openvpn_snprintf (msg_fmt,ERR_BUF_SIZE ,"PLUGIN %s: %s" , name, format); + +va_start (arglist, format); +x_msg_va (msg_flags, msg_fmt, arglist); +va_end (arglist); + +gc_free (&gc); + } +} + +static void plugin_open_item (struct plugin *p, const struct plugin_option *o, struct openvpn_plugin_string_list **retlist,@@ -312,7 +361,8 @@ plugin_open_item (struct plugin *p,if (p->open3) {struct openvpn_plugin_args_open_in args = { p->plugin_type_mask, (const char **const ) o->argv, - (const char **const ) envp }; + (const char **const ) envp, + plugin_log };struct openvpn_plugin_args_open_return retargs;CLEAR (retargs); --1.7.10.4
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Re: [Openvpn-devel] [PATCH 2/2 v2.2] add plugin_log() API to write to openvpn log
And export vprintf variant as well, to allow wrapper.
Quoted 161 lines · Alon Bar-Lev
This is how it should be done, no games with symbols and linkage.
Please add printf style pragmas to the function.
Quoted 156 lines · Heiko Hund
Some plugins want to add messages to the openvpn log file. The
plugin_log()API provides a way for them to do so.Signed-off-by Heiko Hund <[email protected]...>---
This is the second variant of PATCH 2/2 that deals with the fact that the original
plugin_log()approach was not working on Windows.It passes the function pointer of
plugin_log()to the plug-in'sopen_v3hook.Pros:
+ cleaner, more standard approach; less magic
+ no special treatment of Windows necessaryCons:
- only works for plugins supporting theopen_v3API
- bit harder to use as the callback is only available insideopen_v3at firstinclude/openvpn-plugin.h | 25 +++++++++++++++++++++- src/openvpn/plugin.c | 52 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 2 deletions(-)include/openvpn-plugin.h +24
-1@@ -145,7 +145,7 @@ typedef void *openvpn_plugin_handle_t;/* * For Windows (needs to be modified for MSVC) */ -#if defined(__MINGW32_VERSION) && !defined(OPENVPN_PLUGIN_H ) +#if defined(WIN32 ) && !defined(OPENVPN_PLUGIN_H )# define OPENVPN_EXPORT __declspec(dllexport)#else # define OPENVPN_EXPORT @@ -221,12 +221,35 @@ struct openvpn_plugin_string_list* variables in "name=value" format. Note that for security reasons, * these variables are not actually written to the "official" * environmental variable store of the process. +* +* plugin_log : a pointer to the plugin logging function. +* Use this function to add information to the OpenVPN log file. +* Messages will only be displayed if the plugin_name parameter +* is set. Debug messages will only be displayed with plug-in +* debug log verbosity. */ +typedef enum +{ +PLOG_ERR = (1 <<0 ),/* Error condition message */ +PLOG_WARN = (1 <<1 ),/* General warning message */ +PLOG_NOTE = (1 <<2 ),/* Informational message */ +PLOG_DEBUG = (1 <<3 ),/* Debug message, displayed if verb >= 7 */ + +PLOG_ERRNO = (1 <<8 ),/* Add error description to message */ +PLOG_NOMUTE = (1 <<9 ),/* Mute setting does not apply for message */ + +}openvpn_plugin_log_flags_t ; + +typedef void (*plugin_log_t ) (openvpn_plugin_log_flags_t flags, +const char *plugin_name, +const char *format, ...); +struct openvpn_plugin_args_open_in {const int type_mask;const char **const argv;const char **const envp; +plugin_log_t plugin_log; };src/openvpn/plugin.c +51
-2@@ -287,6 +287,55 @@ plugin_init_item (struct plugin *p, const struct plugin_option *o) }static void +plugin_log (openvpn_plugin_log_flags_t flags,const char *name,const char *format, ...) +{ +unsigned int msg_flags; + +if (!format) +return ; + +if (!name || name[0 ] =='\0' ) + { +msg (D_PLUGIN_DEBUG ,"PLUGIN: suppressed log message from plugin with unknown name" ); +return ; + } + +if (flags &PLOG_ERR ) + msg_flags =M_INFO |M_NONFATAL ; +else if (flags &PLOG_WARN ) + msg_flags =M_INFO |M_WARN ; +else if (flags &PLOG_NOTE ) + msg_flags =M_INFO ; +else if (flags &PLOG_DEBUG ) + msg_flags =D_PLUGIN_DEBUG ; + +if (flags &PLOG_ERRNO ) + msg_flags |=M_ERRNO ; +if (flags &PLOG_NOMUTE ) + msg_flags |=M_NOMUTE ; + +if (MSG_TEST (msg_flags)) + { +struct gc_arena gc; +va_list arglist; +char * msg_fmt; + +/* Never add instance prefix; not thread safe */ + msg_flags |=M_NOIPREFIX ; + +gc_init (&gc); + msg_fmt =gc_malloc (ERR_BUF_SIZE , false, &gc); +openvpn_snprintf (msg_fmt,ERR_BUF_SIZE ,"PLUGIN %s: %s" , name, format); + +va_start (arglist, format); +x_msg_va (msg_flags, msg_fmt, arglist); +va_end (arglist); + +gc_free (&gc); + } +} + +static void plugin_open_item (struct plugin *p, const struct plugin_option *o, struct openvpn_plugin_string_list **retlist,@@ -312,7 +361,8 @@ plugin_open_item (struct plugin *p,if (p->open3) {struct openvpn_plugin_args_open_in args = { p->plugin_type_mask, (const char **const ) o->argv, - (const char **const ) envp }; + (const char **const ) envp, + plugin_log };struct openvpn_plugin_args_open_return retargs;CLEAR (retargs); --1.7.10.4
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
PATCH v3 2/2 add API for plug-ins to write to openvpn log
In reply to Heiko HundSome plugins want to add messages to the openvpn log file. The plugin_log() and plugin_vlog() APIs provide ways for them to do so.
---
Changes since PATCH 2/2 v2.2:
* add plugin_vlog() API which takes a va_list
* pass struct openvpn_plugin_callbacks to open_v3 plug-ins
include/openvpn-plugin.h | 46 +++++++++++++++++++++++++++++++++- src/openvpn/plugin.c | 62 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 106 insertions(+), 2 deletions(-)
include/openvpn-plugin.h +45 -1
@@ -43,6 +43,8 @@ typedef X509 openvpn_x509_cert_t;#endif #endif +#include <stdarg.h> +#ifdef __cplusplusextern "C" {#endif
@@ -145,7 +147,7 @@ typedef void *openvpn_plugin_handle_t;/* * For Windows (needs to be modified for MSVC) */ -#if defined(__MINGW32_VERSION) && !defined(OPENVPN_PLUGIN_H ) +#if defined(WIN32 ) && !defined(OPENVPN_PLUGIN_H )# define OPENVPN_EXPORT __declspec(dllexport)#else # define OPENVPN_EXPORT
@@ -205,6 +207,44 @@ struct openvpn_plugin_string_list#define OPENVPN_PLUGINv3_STRUCTVER 1/** +* Definitions needed for the plug-in callback functions. +*/ +typedef enum +{ +PLOG_ERR = (1 <<0 ),/* Error condition message */ +PLOG_WARN = (1 <<1 ),/* General warning message */ +PLOG_NOTE = (1 <<2 ),/* Informational message */ +PLOG_DEBUG = (1 <<3 ),/* Debug message, displayed if verb >= 7 */ + +PLOG_ERRNO = (1 <<8 ),/* Add error description to message */ +PLOG_NOMUTE = (1 <<9 ),/* Mute setting does not apply for message */ + +}openvpn_plugin_log_flags_t ; + +typedef void (*plugin_log_t ) (openvpn_plugin_log_flags_t flags, +const char *plugin_name, +const char *format, ...); +typedef void (*plugin_vlog_t ) (openvpn_plugin_log_flags_t flags, +const char *plugin_name, +const char *format,va_list arglist); + +/** +* Used by the openvpn_plugin_open_v3() function to pass callback +* function pointers to the plug-in. +* +* plugin_log +* plugin_vlog : Use these functions to add information to the OpenVPN log file. +* Messages will only be displayed if the plugin_name parameter +* is set. PLOG_DEBUG messages will only be displayed with plug-in +* debug log verbosity (at the time of writing that's verb >= 7). +*/ +struct openvpn_plugin_callbacks +{ +plugin_log_t plugin_log; +plugin_vlog_t plugin_vlog; +}; + +/** * Arguments used to transport variables to the plug-in. * The struct openvpn_plugin_args_open_in is only used * by the openvpn_plugin_open_v3() function.
@@ -221,12 +261,16 @@ struct openvpn_plugin_string_list* variables in "name=value" format. Note that for security reasons, * these variables are not actually written to the "official" * environmental variable store of the process. +* +* callbacks : a pointer to the plug-in callback function struct. +* */ struct openvpn_plugin_args_open_in {const int type_mask;const char **const argv;const char **const envp; +struct openvpn_plugin_callbacks *callbacks; };
src/openvpn/plugin.c +61 -1
74 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Re: [Openvpn-devel] [PATCH 2/2 v3] add API for plug-ins to write to openvpn log
What about the printf style pragma?
It is very convenience to find format issue at compile times.
Quoted 193 lines · Heiko Hund
Some plugins want to add messages to the openvpn log file. The
plugin_log()andplugin_vlog()APIs provide ways for them to do so.Signed-off-by Heiko Hund <[email protected]...>---
Changes since PATCH 2/2 v2.2:
* add
plugin_vlog()API which takes ava_list
* pass structopenvpn_plugin_callbackstoopen_v3plug-insinclude/openvpn-plugin.h | 46 +++++++++++++++++++++++++++++++++- src/openvpn/plugin.c | 62 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 106 insertions(+), 2 deletions(-)include/openvpn-plugin.h +45
-1@@ -43,6 +43,8 @@ typedef X509 openvpn_x509_cert_t;#endif #endif +#include <stdarg.h> +#ifdef __cplusplusextern "C" {#endif @@ -145,7 +147,7 @@ typedef void *openvpn_plugin_handle_t;/* * For Windows (needs to be modified for MSVC) */ -#if defined(__MINGW32_VERSION) && !defined(OPENVPN_PLUGIN_H ) +#if defined(WIN32 ) && !defined(OPENVPN_PLUGIN_H )# define OPENVPN_EXPORT __declspec(dllexport)#else # define OPENVPN_EXPORT @@ -205,6 +207,44 @@ struct openvpn_plugin_string_list#define OPENVPN_PLUGINv3_STRUCTVER 1/** +* Definitions needed for the plug-in callback functions. +*/ +typedef enum +{ +PLOG_ERR = (1 <<0 ),/* Error condition message */ +PLOG_WARN = (1 <<1 ),/* General warning message */ +PLOG_NOTE = (1 <<2 ),/* Informational message */ +PLOG_DEBUG = (1 <<3 ),/* Debug message, displayed if verb >= 7 */ + +PLOG_ERRNO = (1 <<8 ),/* Add error description to message */ +PLOG_NOMUTE = (1 <<9 ),/* Mute setting does not apply for message */ + +}openvpn_plugin_log_flags_t ; + +typedef void (*plugin_log_t ) (openvpn_plugin_log_flags_t flags, +const char *plugin_name, +const char *format, ...); +typedef void (*plugin_vlog_t ) (openvpn_plugin_log_flags_t flags, +const char *plugin_name, +const char *format,va_list arglist); + +/** +* Used by the openvpn_plugin_open_v3() function to pass callback +* function pointers to the plug-in. +* +* plugin_log +* plugin_vlog : Use these functions to add information to the OpenVPN log file. +* Messages will only be displayed if the plugin_name parameter +* is set. PLOG_DEBUG messages will only be displayed with plug-in +* debug log verbosity (at the time of writing that's verb >= 7). +*/ +struct openvpn_plugin_callbacks +{ +plugin_log_t plugin_log; +plugin_vlog_t plugin_vlog; +}; + +/** * Arguments used to transport variables to the plug-in. * The struct openvpn_plugin_args_open_in is only used * by the openvpn_plugin_open_v3() function. @@ -221,12 +261,16 @@ struct openvpn_plugin_string_list* variables in "name=value" format. Note that for security reasons, * these variables are not actually written to the "official" * environmental variable store of the process. +* +* callbacks : a pointer to the plug-in callback function struct. +* */ struct openvpn_plugin_args_open_in {const int type_mask;const char **const argv;const char **const envp; +struct openvpn_plugin_callbacks *callbacks; };src/openvpn/plugin.c +61
-2@@ -287,6 +287,65 @@ plugin_init_item (struct plugin *p, const struct plugin_option *o) }static void +plugin_vlog (openvpn_plugin_log_flags_t flags,const char *name,const char *format,va_list arglist) +{ +unsigned int msg_flags; + +if (!format) +return ; + +if (!name || name[0 ] =='\0' ) + { +msg (D_PLUGIN_DEBUG ,"PLUGIN: suppressed log message from plugin with unknown name" ); +return ; + } + +if (flags &PLOG_ERR ) + msg_flags =M_INFO |M_NONFATAL ; +else if (flags &PLOG_WARN ) + msg_flags =M_INFO |M_WARN ; +else if (flags &PLOG_NOTE ) + msg_flags =M_INFO ; +else if (flags &PLOG_DEBUG ) + msg_flags =D_PLUGIN_DEBUG ; + +if (flags &PLOG_ERRNO ) + msg_flags |=M_ERRNO ; +if (flags &PLOG_NOMUTE ) + msg_flags |=M_NOMUTE ; + +if (MSG_TEST (msg_flags)) + { +struct gc_arena gc; +char * msg_fmt; + +/* Never add instance prefix; not thread safe */ + msg_flags |=M_NOIPREFIX ; + +gc_init (&gc); + msg_fmt =gc_malloc (ERR_BUF_SIZE , false, &gc); +openvpn_snprintf (msg_fmt,ERR_BUF_SIZE ,"PLUGIN %s: %s" , name, format); +x_msg_va (msg_flags, msg_fmt, arglist); + +gc_free (&gc); + } +} + +static void +plugin_log (openvpn_plugin_log_flags_t flags,const char *name,const char *format, ...) +{ +va_list arglist; +va_start (arglist, format); +plugin_vlog (flags, name, format, arglist); +va_end (arglist); +} + +static struct openvpn_plugin_callbacks callbacks = { + plugin_log, + plugin_vlog +}; + +static void plugin_open_item (struct plugin *p, const struct plugin_option *o, struct openvpn_plugin_string_list **retlist,@@ -312,7 +371,8 @@ plugin_open_item (struct plugin *p,if (p->open3) {struct openvpn_plugin_args_open_in args = { p->plugin_type_mask, (const char **const ) o->argv, - (const char **const ) envp }; + (const char **const ) envp, + &callbacks };struct openvpn_plugin_args_open_return retargs;CLEAR (retargs); --1.7.10.4
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
PATCH v4 2/2 add API for plug-ins to write to openvpn log
In reply to Heiko HundSome plugins want to add messages to the openvpn log file. The plugin_log() and plugin_vlog() APIs provide ways for them to do so.
OPENVPN_PLUGINv3_STRUCTVER is not incremented as the v3 plugin API is new in 2.3 and this is merged during alpha phase.
---
Changes since PATCH 2/2 v3:
* enable gcc specific format checking with log functions
include/openvpn-plugin.h | 61 ++++++++++++++++++++++++++++++++++++++++++++- src/openvpn/plugin.c | 62 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 121 insertions(+), 2 deletions(-)
include/openvpn-plugin.h +60 -1
@@ -43,6 +43,8 @@ typedef X509 openvpn_x509_cert_t;#endif #endif +#include <stdarg.h> +#ifdef __cplusplusextern "C" {#endif
@@ -145,7 +147,7 @@ typedef void *openvpn_plugin_handle_t;/* * For Windows (needs to be modified for MSVC) */ -#if defined(__MINGW32_VERSION) && !defined(OPENVPN_PLUGIN_H ) +#if defined(WIN32 ) && !defined(OPENVPN_PLUGIN_H )# define OPENVPN_EXPORT __declspec(dllexport)#else # define OPENVPN_EXPORT
@@ -205,6 +207,59 @@ struct openvpn_plugin_string_list#define OPENVPN_PLUGINv3_STRUCTVER 1/** +* Definitions needed for the plug-in callback functions. +*/ +typedef enum +{ +PLOG_ERR = (1 <<0 ),/* Error condition message */ +PLOG_WARN = (1 <<1 ),/* General warning message */ +PLOG_NOTE = (1 <<2 ),/* Informational message */ +PLOG_DEBUG = (1 <<3 ),/* Debug message, displayed if verb >= 7 */ + +PLOG_ERRNO = (1 <<8 ),/* Add error description to message */ +PLOG_NOMUTE = (1 <<9 ),/* Mute setting does not apply for message */ + +}openvpn_plugin_log_flags_t ; + + +#ifdef __GNUC__ +#if __USE_MINGW_ANSI_STDIO +# define _ovpn_chk_fmt (a, b) __attribute__ ((format(gnu_printf, (a), (b)))) +#else +# define _ovpn_chk_fmt (a, b) __attribute__ ((format(__printf__, (a), (b)))) +#endif +#else +# define _ovpn_chk_fmt (a, b) +#endif + +typedef void (*plugin_log_t ) (openvpn_plugin_log_flags_t flags, +const char *plugin_name, + const char *format, ...) _ovpn_chk_fmt(3, 4); + +typedef void (*plugin_vlog_t ) (openvpn_plugin_log_flags_t flags, +const char *plugin_name, +const char *format, + va_list arglist) _ovpn_chk_fmt(3, 0); + +#undef _ovpn_chk_fmt + +/** +* Used by the openvpn_plugin_open_v3() function to pass callback +* function pointers to the plug-in. +* +* plugin_log +* plugin_vlog : Use these functions to add information to the OpenVPN log file. +* Messages will only be displayed if the plugin_name parameter +* is set. PLOG_DEBUG messages will only be displayed with plug-in +* debug log verbosity (at the time of writing that's verb >= 7). +*/ +struct openvpn_plugin_callbacks +{ +plugin_log_t plugin_log; +plugin_vlog_t plugin_vlog; +}; + +/** * Arguments used to transport variables to the plug-in. * The struct openvpn_plugin_args_open_in is only used * by the openvpn_plugin_open_v3() function.
@@ -221,12 +276,16 @@ struct openvpn_plugin_string_list* variables in "name=value" format. Note that for security reasons, * these variables are not actually written to the "official" * environmental variable store of the process. +* +* callbacks : a pointer to the plug-in callback function struct. +* */ struct openvpn_plugin_args_open_in {const int type_mask;const char **const argv;const char **const envp; +struct openvpn_plugin_callbacks *callbacks; };
src/openvpn/plugin.c +61 -1
74 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Re: [Openvpn-devel] [PATCH 2/2 v4] add API for plug-ins to write to openvpn log
Thanks, although I think the extra macro is not required.
Last thing I see is that you need to #include <stdarg.h> as va_list is used.
And last style comment, I don't think use of enum for bit fields is common, better to simply #define the constants.
Quoted 210 lines · Heiko Hund
Some plugins want to add messages to the openvpn log file. The
plugin_log()andplugin_vlog()APIs provide ways for them to do so.
OPENVPN_PLUGINv3_STRUCTVERis not incremented as the v3 plugin API is new in 2.3 and this is merged during alpha phase.Signed-off-by Heiko Hund <[email protected]...>---
Changes since PATCH 2/2 v3:
* enable gcc specific format checking with log functions
include/openvpn-plugin.h | 61 ++++++++++++++++++++++++++++++++++++++++++++- src/openvpn/plugin.c | 62 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 121 insertions(+), 2 deletions(-)include/openvpn-plugin.h +60
-1@@ -43,6 +43,8 @@ typedef X509 openvpn_x509_cert_t;#endif #endif +#include <stdarg.h> +#ifdef __cplusplusextern "C" {#endif @@ -145,7 +147,7 @@ typedef void *openvpn_plugin_handle_t;/* * For Windows (needs to be modified for MSVC) */ -#if defined(__MINGW32_VERSION) && !defined(OPENVPN_PLUGIN_H ) +#if defined(WIN32 ) && !defined(OPENVPN_PLUGIN_H )# define OPENVPN_EXPORT __declspec(dllexport)#else # define OPENVPN_EXPORT @@ -205,6 +207,59 @@ struct openvpn_plugin_string_list#define OPENVPN_PLUGINv3_STRUCTVER 1/** +* Definitions needed for the plug-in callback functions. +*/ +typedef enum +{ +PLOG_ERR = (1 <<0 ),/* Error condition message */ +PLOG_WARN = (1 <<1 ),/* General warning message */ +PLOG_NOTE = (1 <<2 ),/* Informational message */ +PLOG_DEBUG = (1 <<3 ),/* Debug message, displayed if verb >= 7 */ + +PLOG_ERRNO = (1 <<8 ),/* Add error description to message */ +PLOG_NOMUTE = (1 <<9 ),/* Mute setting does not apply for message */ + +}openvpn_plugin_log_flags_t ; + + +#ifdef __GNUC__ +#if __USE_MINGW_ANSI_STDIO +# define _ovpn_chk_fmt (a, b) __attribute__ ((format(gnu_printf, (a), (b)))) +#else +# define _ovpn_chk_fmt (a, b) __attribute__ ((format(__printf__, (a), (b)))) +#endif +#else +# define _ovpn_chk_fmt (a, b) +#endif + +typedef void (*plugin_log_t ) (openvpn_plugin_log_flags_t flags, +const char *plugin_name, + const char *format, ...) _ovpn_chk_fmt(3, 4); + +typedef void (*plugin_vlog_t ) (openvpn_plugin_log_flags_t flags, +const char *plugin_name, +const char *format, + va_list arglist) _ovpn_chk_fmt(3, 0); + +#undef _ovpn_chk_fmt + +/** +* Used by the openvpn_plugin_open_v3() function to pass callback +* function pointers to the plug-in. +* +* plugin_log +* plugin_vlog : Use these functions to add information to the OpenVPN log file. +* Messages will only be displayed if the plugin_name parameter +* is set. PLOG_DEBUG messages will only be displayed with plug-in +* debug log verbosity (at the time of writing that's verb >= 7). +*/ +struct openvpn_plugin_callbacks +{ +plugin_log_t plugin_log; +plugin_vlog_t plugin_vlog; +}; + +/** * Arguments used to transport variables to the plug-in. * The struct openvpn_plugin_args_open_in is only used * by the openvpn_plugin_open_v3() function. @@ -221,12 +276,16 @@ struct openvpn_plugin_string_list* variables in "name=value" format. Note that for security reasons, * these variables are not actually written to the "official" * environmental variable store of the process. +* +* callbacks : a pointer to the plug-in callback function struct. +* */ struct openvpn_plugin_args_open_in {const int type_mask;const char **const argv;const char **const envp; +struct openvpn_plugin_callbacks *callbacks; };src/openvpn/plugin.c +61
-2@@ -287,6 +287,65 @@ plugin_init_item (struct plugin *p, const struct plugin_option *o) }static void +plugin_vlog (openvpn_plugin_log_flags_t flags,const char *name,const char *format,va_list arglist) +{ +unsigned int msg_flags; + +if (!format) +return ; + +if (!name || name[0 ] =='\0' ) + { +msg (D_PLUGIN_DEBUG ,"PLUGIN: suppressed log message from plugin with unknown name" ); +return ; + } + +if (flags &PLOG_ERR ) + msg_flags =M_INFO |M_NONFATAL ; +else if (flags &PLOG_WARN ) + msg_flags =M_INFO |M_WARN ; +else if (flags &PLOG_NOTE ) + msg_flags =M_INFO ; +else if (flags &PLOG_DEBUG ) + msg_flags =D_PLUGIN_DEBUG ; + +if (flags &PLOG_ERRNO ) + msg_flags |=M_ERRNO ; +if (flags &PLOG_NOMUTE ) + msg_flags |=M_NOMUTE ; + +if (MSG_TEST (msg_flags)) + { +struct gc_arena gc; +char * msg_fmt; + +/* Never add instance prefix; not thread safe */ + msg_flags |=M_NOIPREFIX ; + +gc_init (&gc); + msg_fmt =gc_malloc (ERR_BUF_SIZE , false, &gc); +openvpn_snprintf (msg_fmt,ERR_BUF_SIZE ,"PLUGIN %s: %s" , name, format); +x_msg_va (msg_flags, msg_fmt, arglist); + +gc_free (&gc); + } +} + +static void +plugin_log (openvpn_plugin_log_flags_t flags,const char *name,const char *format, ...) +{ +va_list arglist; +va_start (arglist, format); +plugin_vlog (flags, name, format, arglist); +va_end (arglist); +} + +static struct openvpn_plugin_callbacks callbacks = { + plugin_log, + plugin_vlog +}; + +static void plugin_open_item (struct plugin *p, const struct plugin_option *o, struct openvpn_plugin_string_list **retlist,@@ -312,7 +371,8 @@ plugin_open_item (struct plugin *p,if (p->open3) {struct openvpn_plugin_args_open_in args = { p->plugin_type_mask, (const char **const ) o->argv, - (const char **const ) envp }; + (const char **const ) envp, + &callbacks };struct openvpn_plugin_args_open_return retargs;CLEAR (retargs); --1.7.10.4
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Re: [Openvpn-devel] [PATCH 2/2 v4] add API for plug-ins to write to openvpn log
Hi Alon
Quoted 1 line · On Thursday 02 August 2012 20:20:45 Alon Bar-Lev wrote:
Thanks, although I think the extra macro is not required.
It looked messy without it. That's why we have it.
Quoted 1 line
Last thing I see is that you need to #include <
stdarg.h> asva_listis used.
It's included already.
Quoted 2 lines
And last style comment, I don't think use of enum for bit fields is common, better to simply #define the constants.
I try to prefer enums over the preprocessor whenever I can. I like that there is a type that you can look up, even if it's not worth much besides that.
Heiko
Signature · 2 lines
Heiko Hund | Sr. Software Engineer | Tel +49-721-25516-237 | Fax -200 SOPHOS NSG | Amalienbadstr. 41 Bau 52 | 76227 Karlsruhe | Germany
Re: [Openvpn-devel] [PATCH 2/2 v4] add API for plug-ins to write to openvpn log
In reply to Heiko HundQuoted 9 lines · Heiko Hund
Some plugins want to add messages to the openvpn log file. The
plugin_log()andplugin_vlog()APIs provide ways for them to do so.
OPENVPN_PLUGINv3_STRUCTVERis not incremented as the v3 plugin API is new in 2.3 and this is merged during alpha phase.Signed-off-by Heiko Hund <[email protected]...>---
Quoted 7 lines
Changes since PATCH 2/2 v3:
* enable gcc specific format checking with log functions
include/openvpn-plugin.h | 61 ++++++++++++++++++++++++++++++++++++++++++++- src/openvpn/plugin.c | 62 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 121 insertions(+), 2 deletions(-)
ACK. Applied to master
commit be532e0d151bc5ad404970fdc7b49e61512a625c
Author: Heiko Hund <[email protected]...> Date: Thu Aug 2 17:20:22 2012 +0200
add API for plug-ins to write to openvpn log
Signed-off-by: Heiko Hund <[email protected]...>
Acked-by: David Sommerseth <[email protected]...>
Message-Id: [email protected]...
URL: http://article.gmane.org/gmane.network.openvpn.devel/6946
Signed-off-by: David Sommerseth <[email protected]...>kind regards,
David Sommerseth