From 9dd2760fd337b39b72eb38189c093f5a156292f2 Mon Sep 17 00:00:00 2001 From: Phil Lavin Date: Wed, 24 Feb 2016 12:06:41 +0000 Subject: [PATCH 1/2] tls: enhance the logging of ssl bug #1491 workaround - log shm_available_safe() instead of shm_available() as this is what is actually compared in the check - also log the relevant threshold as it is not always obvious if the default value is being used --- modules/tls/tls_server.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/tls/tls_server.c b/modules/tls/tls_server.c index e5f838d8491..3627f0701b0 100644 --- a/modules/tls/tls_server.c +++ b/modules/tls/tls_server.c @@ -186,7 +186,7 @@ static int tls_complete_init(struct tcp_connection* c) if (LOW_MEM_NEW_CONNECTION_TEST()){ ERR("tls: ssl bug #1491 workaround: not enough memory for safe" - " operation: %lu\n", shm_available()); + " operation: shm=%lu threshold1=%d\n", shm_available_safe(), cfg_get(tls, tls_cfg, low_mem_threshold1)); goto error2; } /* Get current TLS configuration and increase reference @@ -294,7 +294,7 @@ static int tls_fix_connection_unsafe(struct tcp_connection* c) } }else if (unlikely(LOW_MEM_CONNECTED_TEST())){ ERR("tls: ssl bug #1491 workaround: not enough memory for safe" - " operation: %lu\n", shm_available()); + " operation: shm=%lu threshold2=%d\n", shm_available_safe(), cfg_get(tls, tls_cfg, low_mem_threshold2)); return -1; } return 0; @@ -324,7 +324,7 @@ static int tls_fix_connection(struct tcp_connection* c) } if (unlikely(LOW_MEM_CONNECTED_TEST())){ ERR("tls: ssl bug #1491 workaround: not enough memory for safe" - " operation: %lu\n", shm_available()); + " operation: shm=%lu threshold2=%d\n", shm_available_safe(), cfg_get(tls, tls_cfg, low_mem_threshold2)); return -1; } return 0; @@ -527,7 +527,7 @@ static int tls_shutdown(struct tcp_connection *c) return 0; if (unlikely(LOW_MEM_CONNECTED_TEST())){ ERR("tls: ssl bug #1491 workaround: not enough memory for safe" - " operation: %lu\n", shm_available()); + " operation: shm=%lu threshold2=%d\n", shm_available_safe(), cfg_get(tls, tls_cfg, low_mem_threshold2)); goto err; } From 8736b2dc8dcd5fd8ee253134b19cb8ce0aa1c0b4 Mon Sep 17 00:00:00 2001 From: Phil Lavin Date: Wed, 24 Feb 2016 12:21:42 +0000 Subject: [PATCH 2/2] tls: fix line breaks - fix line breaks in previous logging commit --- modules/tls/tls_server.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/tls/tls_server.c b/modules/tls/tls_server.c index 3627f0701b0..880fae25aa7 100644 --- a/modules/tls/tls_server.c +++ b/modules/tls/tls_server.c @@ -186,7 +186,8 @@ static int tls_complete_init(struct tcp_connection* c) if (LOW_MEM_NEW_CONNECTION_TEST()){ ERR("tls: ssl bug #1491 workaround: not enough memory for safe" - " operation: shm=%lu threshold1=%d\n", shm_available_safe(), cfg_get(tls, tls_cfg, low_mem_threshold1)); + " operation: shm=%lu threshold1=%d\n", shm_available_safe(), + cfg_get(tls, tls_cfg, low_mem_threshold1)); goto error2; } /* Get current TLS configuration and increase reference @@ -294,7 +295,8 @@ static int tls_fix_connection_unsafe(struct tcp_connection* c) } }else if (unlikely(LOW_MEM_CONNECTED_TEST())){ ERR("tls: ssl bug #1491 workaround: not enough memory for safe" - " operation: shm=%lu threshold2=%d\n", shm_available_safe(), cfg_get(tls, tls_cfg, low_mem_threshold2)); + " operation: shm=%lu threshold2=%d\n", shm_available_safe(), + cfg_get(tls, tls_cfg, low_mem_threshold2)); return -1; } return 0; @@ -324,7 +326,8 @@ static int tls_fix_connection(struct tcp_connection* c) } if (unlikely(LOW_MEM_CONNECTED_TEST())){ ERR("tls: ssl bug #1491 workaround: not enough memory for safe" - " operation: shm=%lu threshold2=%d\n", shm_available_safe(), cfg_get(tls, tls_cfg, low_mem_threshold2)); + " operation: shm=%lu threshold2=%d\n", shm_available_safe(), + cfg_get(tls, tls_cfg, low_mem_threshold2)); return -1; } return 0; @@ -527,7 +530,8 @@ static int tls_shutdown(struct tcp_connection *c) return 0; if (unlikely(LOW_MEM_CONNECTED_TEST())){ ERR("tls: ssl bug #1491 workaround: not enough memory for safe" - " operation: shm=%lu threshold2=%d\n", shm_available_safe(), cfg_get(tls, tls_cfg, low_mem_threshold2)); + " operation: shm=%lu threshold2=%d\n", shm_available_safe(), + cfg_get(tls, tls_cfg, low_mem_threshold2)); goto err; }