plaisthos has uploaded this change for review. (
http://gerrit.openvpn.net/c/openvpn/+/1942?usp=email )
Change subject: Change most ENABLE_DEBUG ifdefs to ifndef ENABLE_SMALL
......................................................................
Change most ENABLE_DEBUG ifdefs to ifndef ENABLE_SMALL
Most of these are verbose logging or even enable logging at high
verbosity level or just useful tools like --show-gateway.
We had --enabled-debug on by default forever, so these "debug"
logs are on by default. This patch instead moves them to
enable-small.
Change-Id: I3f96cd1c3488b558b8a597594d99edcba1214d27
---
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls_legacy.c
M src/openvpn/error.h
M src/openvpn/event.c
M src/openvpn/forward.c
M src/openvpn/mroute.c
M src/openvpn/mtcp.c
M src/openvpn/mudp.c
M src/openvpn/multi.c
M src/openvpn/multi_io.c
M src/openvpn/options.c
M src/openvpn/packet_id.c
M src/openvpn/plugin.c
M src/openvpn/plugin.h
M src/openvpn/reliable.c
M src/openvpn/route.c
M src/openvpn/schedule.c
M src/tapctl/error.h
18 files changed, 35 insertions(+), 34 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/1942/1
diff --git a/src/openvpn/crypto_mbedtls.c b/src/openvpn/crypto_mbedtls.c
index 0c5beb4..9d19902 100644
--- a/src/openvpn/crypto_mbedtls.c
+++ b/src/openvpn/crypto_mbedtls.c
@@ -842,7 +842,7 @@
struct gc_arena gc = gc_new();
uint8_t A1[MAX_HMAC_KEY_LENGTH];
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
/* used by the D_SHOW_KEY_SOURCE, guarded with ENABLE_DEBUG to avoid unused
* variables warnings if compiled with --enable-small */
const size_t olen_orig = olen;
diff --git a/src/openvpn/crypto_mbedtls_legacy.c
b/src/openvpn/crypto_mbedtls_legacy.c
index bbd012f6..f46d8bf 100644
--- a/src/openvpn/crypto_mbedtls_legacy.c
+++ b/src/openvpn/crypto_mbedtls_legacy.c
@@ -989,8 +989,8 @@
struct gc_arena gc = gc_new();
uint8_t A1[MAX_HMAC_KEY_LENGTH];
-#ifdef ENABLE_DEBUG
- /* used by the D_SHOW_KEY_SOURCE, guarded with ENABLE_DEBUG to avoid unused
+#ifndef ENABLE_SMALL
+ /* used by the D_SHOW_KEY_SOURCE, guarded with ENABLE_SMALL to avoid unused
* variables warnings if compiled with --enable-small */
const size_t olen_orig = olen;
const uint8_t *out_orig = out;
diff --git a/src/openvpn/error.h b/src/openvpn/error.h
index a887fc7..5811bef 100644
--- a/src/openvpn/error.h
+++ b/src/openvpn/error.h
@@ -158,7 +158,7 @@
} \
EXIT_FATAL(flags); \
} while (false)
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
#define dmsg(flags, ...) \
do \
{ \
diff --git a/src/openvpn/event.c b/src/openvpn/event.c
index 8b7716a..2cb4e04 100644
--- a/src/openvpn/event.c
+++ b/src/openvpn/event.c
@@ -398,7 +398,7 @@
dmsg(D_EVENT_WAIT, "WE_WAIT enter n=%d to=%d", wes->n_events, timeout);
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
if (check_debug_level(D_EVENT_WAIT))
{
int i;
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 6fe5849..7811245 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -50,7 +50,7 @@
/* show event wait debugging info */
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
static const char *
wait_status_string(struct context *c, struct gc_arena *gc)
@@ -2190,7 +2190,7 @@
{
int status;
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
if (check_debug_level(D_EVENT_WAIT))
{
show_wait_status(c);
diff --git a/src/openvpn/mroute.c b/src/openvpn/mroute.c
index 39fa482..261d25a 100644
--- a/src/openvpn/mroute.c
+++ b/src/openvpn/mroute.c
@@ -501,7 +501,7 @@
}
mh->n_net_len = j;
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
if (check_debug_level(D_MULTI_DEBUG))
{
struct gc_arena gc = gc_new();
diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c
index 5d88f8a..b0125f1 100644
--- a/src/openvpn/mtcp.c
+++ b/src/openvpn/mtcp.c
@@ -74,7 +74,7 @@
mi->did_real_hash = true;
}
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
if (mi)
{
dmsg(D_MULTI_DEBUG, "MULTI TCP: instance added: %s",
mroute_addr_print(&mi->real, &gc));
diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c
index 88b0091..4794b7e 100644
--- a/src/openvpn/mudp.c
+++ b/src/openvpn/mudp.c
@@ -431,7 +431,7 @@
}
}
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
if (check_debug_level(D_MULTI_DEBUG))
{
struct gc_arena gc = gc_new();
diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index 3e72b92..67204c3 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -1145,7 +1145,7 @@
}
}
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
if (check_debug_level(D_MULTI_DEBUG))
{
struct gc_arena gc = gc_new();
diff --git a/src/openvpn/multi_io.c b/src/openvpn/multi_io.c
index 3604684..4b96c57 100644
--- a/src/openvpn/multi_io.c
+++ b/src/openvpn/multi_io.c
@@ -46,7 +46,7 @@
#define MULTI_IO_FILE_CLOSE_WRITE ((void *)5)
#define MULTI_IO_DCO ((void *)6)
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
static const char *
pract(int action)
{
@@ -89,7 +89,7 @@
return "?";
}
}
-#endif /* ENABLE_DEBUG */
+#endif
static inline struct context *
multi_get_context(struct multi_context *m, struct multi_instance *mi)
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 133c035..01de12b 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -785,7 +785,7 @@
#endif /* ENABLE_PKCS11 */
"\n"
"General Standalone Options:\n"
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
"--show-gateway [address]: Show info about gateway [to v4/v6 address].\n"
#endif
;
@@ -4229,7 +4229,7 @@
read_config_file(options, p[1], level, file, line, msglevel,
permission_mask,
option_types_found, es);
}
-#if defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL)
+#if !defined(ENABLE_SMALL)
else if (streq(p[0], "show-gateway") && !p[2])
{
struct route_gateway_info rgi;
@@ -4938,12 +4938,13 @@
* mbed TLS always generating debug level logging */
options->ssl_flags |= SSLF_TLS_DEBUG_ENABLED;
}
-#if !defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL)
+#if defined(ENABLE_SMALL)
/* Warn when a debug verbosity is supplied when built without debug
support */
if (options->verbosity >= 7)
{
msg(M_WARN,
- "NOTE: debug verbosity (--verb %d) is enabled but this build
lacks debug support.",
+ "NOTE: debug verbosity (--verb %d) is enabled but this build
is "
+ "built with --enable-small that lacks support for high --verb
settings",
options->verbosity);
}
#endif
diff --git a/src/openvpn/packet_id.c b/src/openvpn/packet_id.c
index a4b627c..22c53c7 100644
--- a/src/openvpn/packet_id.c
+++ b/src/openvpn/packet_id.c
@@ -52,18 +52,18 @@
#define SEQ_UNSEEN ((time_t)0)
#define SEQ_EXPIRED ((time_t)1)
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
static void 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);
-#endif /* ENABLE_DEBUG */
+#endif
static inline void
packet_id_debug(msglvl_t msglevel, const struct packet_id_rec *p,
const struct packet_id_net *pin, const char *message, uint64_t
value)
{
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
if (unlikely(check_debug_level(msglevel)))
{
packet_id_debug_print(msglevel, p, pin, message, value);
@@ -576,7 +576,7 @@
return (char *)out.data;
}
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
static void
packet_id_debug_print(msglvl_t msglevel, const struct packet_id_rec *p,
@@ -648,7 +648,7 @@
gc_free(&gc);
}
-#endif /* ifdef ENABLE_DEBUG */
+#endif
uint16_t
packet_id_read_epoch(struct packet_id_net *pin, struct buffer *buf)
diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c
index f8adde5..d10f9fa 100644
--- a/src/openvpn/plugin.c
+++ b/src/openvpn/plugin.c
@@ -993,7 +993,7 @@
pr->n = 0;
}
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
void
plugin_return_print(const msglvl_t msglevel, const char *prefix, const struct
plugin_return *pr)
{
diff --git a/src/openvpn/plugin.h b/src/openvpn/plugin.h
index 7e9faf3..684632c 100644
--- a/src/openvpn/plugin.h
+++ b/src/openvpn/plugin.h
@@ -135,7 +135,7 @@
void plugin_return_free(struct plugin_return *pr);
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
void plugin_return_print(const msglvl_t msglevel, const char *prefix, const
struct plugin_return *pr);
#endif
diff --git a/src/openvpn/reliable.c b/src/openvpn/reliable.c
index ced438e..b5315ff 100644
--- a/src/openvpn/reliable.c
+++ b/src/openvpn/reliable.c
@@ -462,7 +462,7 @@
}
}
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
/* print the current sequence of active packet IDs */
static const char *
reliable_print_ids(const struct reliable *rel, struct gc_arena *gc)
@@ -480,7 +480,7 @@
}
return BSTR(&out);
}
-#endif /* ENABLE_DEBUG */
+#endif
/* true if at least one free buffer available */
bool
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index 03a2526..a9a6dcc 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -81,7 +81,7 @@
static void get_bypass_addresses(struct route_bypass *rb, const unsigned int
flags);
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
static void
print_bypass_addresses(const struct route_bypass *rb)
@@ -617,7 +617,7 @@
if (rl->ngi.flags & RGI_ADDR_DEFINED)
{
setenv_route_addr(es, "net_gateway", rl->ngi.gateway.addr, -1);
-#if defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL)
+#if !defined(ENABLE_SMALL)
print_default_gateway(D_ROUTE, &rl->rgi, NULL);
#endif
}
@@ -660,7 +660,7 @@
add_block_local_routes(rl);
}
get_bypass_addresses(&rl->spec.bypass, rl->flags);
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
print_bypass_addresses(&rl->spec.bypass);
#endif
}
@@ -768,7 +768,7 @@
if (rl6->ngi6.flags & RGI_ADDR_DEFINED)
{
setenv_str(es, "net_gateway_ipv6",
print_in6_addr(rl6->ngi6.gateway.addr_ipv6, 0, &gc));
-#if defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL)
+#if !defined(ENABLE_SMALL)
print_default_gateway(D_ROUTE, NULL, &rl6->rgi6);
#endif
}
diff --git a/src/openvpn/schedule.c b/src/openvpn/schedule.c
index 6772ad6..6c60dc2 100644
--- a/src/openvpn/schedule.c
+++ b/src/openvpn/schedule.c
@@ -33,7 +33,7 @@
#include "memdbg.h"
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
static void
schedule_entry_debug_info(const char *caller, const struct schedule_entry *e)
{
@@ -308,7 +308,7 @@
void
schedule_add_modify(struct schedule *s, struct schedule_entry *e)
{
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
if (check_debug_level(D_SCHEDULER))
{
schedule_entry_debug_info("schedule_add_modify", e);
@@ -355,7 +355,7 @@
}
}
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
if (check_debug_level(D_SCHEDULER))
{
schedule_entry_debug_info("schedule_find_least", e);
diff --git a/src/tapctl/error.h b/src/tapctl/error.h
index f9586dc..34aa894 100644
--- a/src/tapctl/error.h
+++ b/src/tapctl/error.h
@@ -83,7 +83,7 @@
} \
EXIT_FATAL(flags); \
} while (false)
-#ifdef ENABLE_DEBUG
+#ifndef ENABLE_SMALL
#define dmsg(flags, ...) \
do \
{ \
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1942?usp=email
To unsubscribe, or for help writing mail filters, visit
http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3f96cd1c3488b558b8a597594d99edcba1214d27
Gerrit-Change-Number: 1942
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel