Ticket #260: 0001-Fix-verb4-with-non-debug.patch

File 0001-Fix-verb4-with-non-debug.patch, 4.6 KB (added by JoshC, 8 years ago)

Fix parameter listing in non-debug builds at verb 4

  • src/openvpn/options.c

    From c6f6bfa0cc6b0313872eb2c5149c364bf939042a Mon Sep 17 00:00:00 2001
    From: Josh Cepek <josh.cepek@usa.net>
    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.
    
    Signed-off-by: Josh Cepek <josh.cepek@usa.net>
    ---
     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(-)
    
    diff --git a/src/openvpn/options.c b/src/openvpn/options.c
    index 8ca41a3..ae0e1e7 100644
    a b uninit_options (struct options *o) 
    881881    }
    882882}
    883883
    884 #ifdef ENABLE_DEBUG
     884#ifndef ENABLE_SMALL
    885885
    886886#define SHOW_PARM(name, value, format) msg(D_SHOW_PARMS, "  " #name " = " format, (value))
    887887#define SHOW_STR(var)       SHOW_PARM(var, (o->var ? o->var : "[UNDEF]"), "'%s'")
    parse_hash_fingerprint(const char *str, int nbytes, int msglevel, struct gc_aren 
    10811081
    10821082#ifdef WIN32
    10831083
    1084 #ifdef ENABLE_DEBUG
     1084#ifndef ENABLE_SMALL
    10851085
    10861086static void
    10871087show_dhcp_option_addrs (const char *name, const in_addr_t *array, int len)
    dhcp_option_address_parse (const char *name, const char *parm, in_addr_t *array, 
    11531153
    11541154#if P2MP
    11551155
    1156 #ifdef ENABLE_DEBUG
     1156#ifndef ENABLE_SMALL
    11571157
    11581158static void
    11591159show_p2mp_parms (const struct options *o)
    show_p2mp_parms (const struct options *o) 
    12251225  gc_free (&gc);
    12261226}
    12271227
    1228 #endif /* ENABLE_DEBUG */
     1228#endif /* ! ENABLE_SMALL */
    12291229
    12301230#if P2MP_SERVER
    12311231
    option_iroute_ipv6 (struct options *o, 
    12791279#endif /* P2MP_SERVER */
    12801280#endif /* P2MP */
    12811281
    1282 #if defined(ENABLE_HTTP_PROXY) && defined(ENABLE_DEBUG)
     1282#if defined(ENABLE_HTTP_PROXY) && !defined(ENABLE_SMALL)
    12831283static void
    12841284show_http_proxy_options (const struct http_proxy_options *o)
    12851285{
    cnol_check_alloc (struct options *options) 
    13321332}
    13331333#endif
    13341334
    1335 #ifdef ENABLE_DEBUG
     1335#ifndef ENABLE_SMALL
    13361336static void
    13371337show_connection_entry (const struct connection_entry *o)
    13381338{
    show_connection_entries (const struct options *o) 
    14001400void
    14011401show_settings (const struct options *o)
    14021402{
    1403 #ifdef ENABLE_DEBUG
     1403#ifndef ENABLE_SMALL
    14041404  msg (D_SHOW_PARMS, "Current Parameter Settings:");
    14051405
    14061406  SHOW_STR (config);
  • src/openvpn/plugin.c

    diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c
    index 83f79e4..c96c121 100644
    a b plugin_option_list_add (struct plugin_option_list *list, char **p, struct gc_are 
    155155    return false;
    156156}
    157157
    158 #ifdef ENABLE_DEBUG
     158#ifndef ENABLE_SMALL
    159159void
    160160plugin_option_list_print (const struct plugin_option_list *list, int msglevel)
    161161{
  • src/openvpn/plugin.h

    diff --git a/src/openvpn/plugin.h b/src/openvpn/plugin.h
    index 4ba150d..2f8416b 100644
    a b struct plugin_return 
    108108struct plugin_option_list *plugin_option_list_new (struct gc_arena *gc);
    109109bool plugin_option_list_add (struct plugin_option_list *list, char **p, struct gc_arena *gc);
    110110
    111 #ifdef ENABLE_DEBUG
     111#ifndef ENABLE_SMALL
    112112void plugin_option_list_print (const struct plugin_option_list *list, int msglevel);
    113113#endif
    114114
  • src/openvpn/route.c

    diff --git a/src/openvpn/route.c b/src/openvpn/route.c
    index dd69d8e..134ed58 100644
    a b delete_routes (struct route_list *rl, struct route_ipv6_list *rl6, 
    10891089    }
    10901090}
    10911091
    1092 #ifdef ENABLE_DEBUG
     1092#ifndef ENABLE_SMALL
    10931093
    10941094static const char *
    10951095show_opt (const char *option)
  • src/openvpn/route.h

    diff --git a/src/openvpn/route.h b/src/openvpn/route.h
    index e63db59..a40de32 100644
    a b void print_default_gateway(const int msglevel, const struct route_gateway_info * 
    290290#define TLA_LOCAL           2
    291291int test_local_addr (const in_addr_t addr, const struct route_gateway_info *rgi);
    292292
    293 #ifdef ENABLE_DEBUG
     293#ifndef ENABLE_SMALL
    294294void print_route_options (const struct route_option_list *rol,
    295295                          int level);
    296296#endif