Skip to contentSkip to conversation

Fix parameter listing in non-debug builds at verb 4

PATCH In review Josh Cepek 3 participants 3 messages Feb 21, 2013 – Mar 14, 2013

lore
Share & tools
lore

Josh Cepek

author
#0 lore raw

PATCH 1/1 Fix parameter listing in non-debug builds at verb 4

The patch is attached; a summary, and mitigating build suggestion follows:

The current official Windows builds of 2.3.0 up to I004 are built enable_debug=no; I'm not sure about the repo builds since I build from source on my non-Windows systems, but the same issue is present when lacking debug support on Linux/Unix. This causes such builds to lack parameter printing at --verb 4 which conflicts with the help output and configure text for enable_small. This is a particular issue for binary installations (Windows, or binary *nix distros.)

Until this change makes its way into the release repo branches, I'd suggest all official builds be built with enable_debug=yes. Without this build option, end-users will be unable to make use of increased verbosity/troubleshooting provided at verb 4.

Commit/code reasoning for the patch: (also present in attached patch for convenience.) This patch applies to either the v2.3.0 tag, or current HEAD.

When built with enable_debug=no, the parameter output expected at --verb 4 is not printed due to use of #ifdef ENABLE_DEBUG in the responsible code sections. This appears to be a mistake when looking at the configure help text for enable_small and enable_debug.

This change keys the relevant code off of enable_small instead, including the parameter listing when enale_small=no (the configure-script default.) Most of this code is in options.c, with some callers present in plugin.c/h and route.c/h. No function code is changed, just the #ifdef values to use the small feature instead of debug.

This means builds no longer need enable_debug=yes in order to get the expected log output at verb 4.

--
Josh

From c6f6bfa0cc6b0313872eb2c5149c364bf939042a Mon Sep 17 00:00:00 2001
From: Josh Cepek <[email protected]>
Date: Thu, 21 Feb 2013 09:50:38 -0600
Subject: [PATCH] Fix parameter listing in non-debug builds at verb 4

When built with enable_debug=no, the parameter output expected at --verb 4 is not printed due to use of #ifdef ENABLE_DEBUG in the responsible code sections. This appears to be a mistake when looking at the configure help text for enable_small and enable_debug.

This change keys the relevant code off of enable_small instead, including the parameter listing when enale_small=no (the configure-script default.) Most of this code is in options.c, with some callers present in plugin.c/h and route.c/h. No function code is changed, just the #ifdef values to use the small feature instead of debug.

This means builds no longer need enable_debug=yes in order to get the expected log output at verb 4.

---
 src/openvpn/options.c | 14 +++++++-------
 src/openvpn/plugin.c  |  2 +-
 src/openvpn/plugin.h  |  2 +-
 src/openvpn/route.c   |  2 +-
 src/openvpn/route.h   |  2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)
src/openvpn/options.c +7 -7
index 8ca41a3..ae0e1e7 100644
@@ -881,7 +881,7 @@ uninit_options (struct options *o)
     }
 }
 
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
 
 #define SHOW_PARM(name, value, format) msg(D_SHOW_PARMS, "  " #name " = " format, (value))
 #define SHOW_STR(var)       SHOW_PARM(var, (o->var ? o->var : "[UNDEF]"), "'%s'")
@@ -1081,7 +1081,7 @@ parse_hash_fingerprint(const char *str, int nbytes, int msglevel, struct gc_aren
 
 #ifdef WIN32
 
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
 
 static void
 show_dhcp_option_addrs (const char *name, const in_addr_t *array, int len)
@@ -1153,7 +1153,7 @@ dhcp_option_address_parse (const char *name, const char *parm, in_addr_t *array,
 
 #if P2MP
 
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
 
 static void
 show_p2mp_parms (const struct options *o)
@@ -1225,7 +1225,7 @@ show_p2mp_parms (const struct options *o)
   gc_free (&gc);
 }
 
-#endif /* ENABLE_DEBUG */
+#endif /* ! ENABLE_SMALL */
 
 #if P2MP_SERVER
 
@@ -1279,7 +1279,7 @@ option_iroute_ipv6 (struct options *o,
 #endif /* P2MP_SERVER */
 #endif /* P2MP */
 
-#if defined(ENABLE_HTTP_PROXY) && defined(ENABLE_DEBUG)
+#if defined(ENABLE_HTTP_PROXY) && !defined(ENABLE_SMALL)
 static void
 show_http_proxy_options (const struct http_proxy_options *o)
 {
@@ -1332,7 +1332,7 @@ cnol_check_alloc (struct options *options)
 }
 #endif
 
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
 static void
 show_connection_entry (const struct connection_entry *o)
 {
@@ -1400,7 +1400,7 @@ show_connection_entries (const struct options *o)
 void
 show_settings (const struct options *o)
 {
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
   msg (D_SHOW_PARMS, "Current Parameter Settings:");
 
   SHOW_STR (config);
src/openvpn/plugin.c +1 -1
index 83f79e4..c96c121 100644
@@ -155,7 +155,7 @@ plugin_option_list_add (struct plugin_option_list *list, char **p, struct gc_are
     return false;
 }
 
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
 void
 plugin_option_list_print (const struct plugin_option_list *list, int msglevel)
 {
src/openvpn/plugin.h +1 -1
index 4ba150d..2f8416b 100644
@@ -108,7 +108,7 @@ struct plugin_return
 struct plugin_option_list *plugin_option_list_new (struct gc_arena *gc);
 bool plugin_option_list_add (struct plugin_option_list *list, char **p, struct gc_arena *gc);
 
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
 void plugin_option_list_print (const struct plugin_option_list *list, int msglevel);
 #endif
 
src/openvpn/route.c +1 -1
index dd69d8e..134ed58 100644
@@ -1089,7 +1089,7 @@ delete_routes (struct route_list *rl, struct route_ipv6_list *rl6,
     }
 }
 
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
 
 static const char *
 show_opt (const char *option)
src/openvpn/route.h +1 -1
index e63db59..a40de32 100644
@@ -290,7 +290,7 @@ void print_default_gateway(const int msglevel, const struct route_gateway_info *
 #define TLA_LOCAL           2
 int test_local_addr (const in_addr_t addr, const struct route_gateway_info *rgi);
 
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
 void print_route_options (const struct route_option_list *rol,
 			  int level);
 #endif
Signature · 1 line
1.7.12.4
#1 lore raw

Am 21.02.13 17:53, schrieb Josh Cepek:

Quoted 24 lines

The patch is attached; a summary, and mitigating build suggestion follows:

The current official Windows builds of 2.3.0 up to I004 are built enable_debug=no; I'm not sure about the repo builds since I build from source on my non-Windows systems, but the same issue is present when lacking debug support on Linux/Unix. This causes such builds to lack parameter printing at --verb 4 which conflicts with the help output and configure text for enable_small. This is a particular issue for binary installations (Windows, or binary *nix distros.)

Until this change makes its way into the release repo branches, I'd suggest all official builds be built with enable_debug=yes. Without this build option, end-users will be unable to make use of increased verbosity/troubleshooting provided at verb 4.

Commit/code reasoning for the patch: (also present in attached patch for convenience.) This patch applies to either the v2.3.0 tag, or current HEAD.

When built with enable_debug=no, the parameter output expected at --verb 4 is not printed due to use of #ifdef ENABLE_DEBUG in the responsible code sections. This appears to be a mistake when looking at the configure help text for enable_small and enable_debug.

Quoted 9 lines

This change keys the relevant code off of enable_small instead, including the parameter listing when enale_small=no (the configure-script default.) Most of this code is in options.c, with some callers present in plugin.c/h and route.c/h. No function code is changed, just the #ifdef values to use the small feature instead of debug.

This means builds no longer need enable_debug=yes in order to get the expected log output at verb 4.

Ack to the patch. I think it is reseanable to show the parameters in higher debug output but enable_debug also enables *a lot* of other output. Can you add a second patch or modify this patch to print a warning at verb 7 (after a quick look all dmsg output are >= verb 7) that debug is not enabled and messages from the output might be missing?

Arne

#2 lore raw
In reply to Josh Cepek

Your patch has been applied to the master and release/2.3 branch.

commit 6c61d0dd339084175f6911d8b713faaf4967ca03 (master) commit c4358645fb37b7c4d9c82c0b7b8b4f17ec4cf326 (release/2.3)

Author: Josh Cepek
Date:   Thu Feb 21 09:50:38 2013 -0600
     Fix parameter listing in non-debug builds at verb 4

     Signed-off-by: Josh Cepek <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/7361
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering