Skip to contentSkip to conversation

polarssl: actually use polarssl debug logging

PATCH In review Steffan Karger 2 participants 2 messages Jan 6, 2016 – Jan 7, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 polarssl: actually use polarssl debug logging

We had the machinery in place, but did not actually use it because nothing will be logged untill the debug threshold is increased.

This commit makes --verb 8 result is level 2 polar logging (which is verbose, and --verb 9 result in level 3 polar logging (which is very verbose). There are higher levels, but those are extremely verbose.

---
 src/openvpn/ssl_polarssl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
src/openvpn/ssl_polarssl.c +4 -2
index 339d1fb..58b2116 100644
@@ -49,6 +49,7 @@
 #include <polarssl/havege.h>
 
 #include "ssl_verify_polarssl.h"
+#include <polarssl/debug.h>
 #include <polarssl/error.h>
 #include <polarssl/oid.h>
 #include <polarssl/pem.h>
@@ -679,8 +680,8 @@ static int endless_buf_write( void *ctx, const unsigned char *in, size_t len )
 
 static void my_debug( void *ctx, int level, const char *str )
 {
-  int my_loglevel = (level < 2) ? D_TLS_DEBUG_MED : D_TLS_DEBUG;
-  msg (my_loglevel, "PolarSSL alert: %s", str);
+  int my_loglevel = (level < 3) ? D_TLS_DEBUG_MED : D_TLS_DEBUG;
+  msg (my_loglevel, "PolarSSL msg: %s", str);
 }
 
 /*
@@ -762,6 +763,7 @@ void key_state_ssl_init(struct key_state_ssl *ks_ssl,
   if (polar_ok(ssl_init(ks_ssl->ctx)))
     {
       /* Initialise SSL context */
+      debug_set_threshold(3);
       ssl_set_dbg (ks_ssl->ctx, my_debug, NULL);
       ssl_set_endpoint (ks_ssl->ctx, ssl_ctx->endpoint);
 
Signature · 1 line
2.5.0
#1 lore raw

ACK. Tested, does what it says on the tin.

Your patch has been applied to the master branch (and I expect it to show up in 2.3 as part of the "polarssl logging improvements 1/2 v2").

commit aa416be9500441313c703ad7cb848c289378bbd3 (master)

Author: Steffan Karger
Date:   Wed Jan 6 21:59:03 2016 +0100
     polarssl: actually use polarssl debug logging

     Signed-off-by: Steffan Karger <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/10945
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering