All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] rngd: fix --debug to also filter syslog() calls
@ 2020-10-09 13:35 Yann Dirson
  0 siblings, 0 replies; only message in thread
From: Yann Dirson @ 2020-10-09 13:35 UTC (permalink / raw)
  To: openembedded-core; +Cc: Yann Dirson

From: Yann Dirson <yann@blade-group.com>

Debug logs were only controlled by --debug flag while in --foreground mode.
In --daemon mode (the default for us) /var/log/message got stuffed with
details of entropy pool refilling, which is useless in production, and
hamful when log rotation then gets rid of the more useful logs.

This change makes the two modes consistently only produce debug logs when
--debug is specified.

Signed-off-by: Yann Dirson <yann@blade-group.com>
---
 ...ix-debug-to-also-filter-syslog-calls.patch | 46 +++++++++++++++++++
 .../rng-tools/rng-tools_6.10.bb               |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 meta/recipes-support/rng-tools/rng-tools/0001-rngd-fix-debug-to-also-filter-syslog-calls.patch

diff --git a/meta/recipes-support/rng-tools/rng-tools/0001-rngd-fix-debug-to-also-filter-syslog-calls.patch b/meta/recipes-support/rng-tools/rng-tools/0001-rngd-fix-debug-to-also-filter-syslog-calls.patch
new file mode 100644
index 0000000000..85d2add6c3
--- /dev/null
+++ b/meta/recipes-support/rng-tools/rng-tools/0001-rngd-fix-debug-to-also-filter-syslog-calls.patch
@@ -0,0 +1,46 @@
+From 213a869e8315ead2c739acfcbde712358a842dee Mon Sep 17 00:00:00 2001
+From: Yann Dirson <yann@blade-group.com>
+Date: Fri, 9 Oct 2020 15:12:26 +0200
+Subject: [PATCH] rngd: fix --debug to also filter syslog() calls
+
+Debug logs were only controlled by --debug flag while in --foreground
+mode.  In --daemon mode /var/log/message got stuffed with details of
+entropy pool refilling, which is useless in production, and hamful
+when log rotation then gets rid of the more useful logs.  This is
+especially true for embedded systems.
+
+This change makes the two modes consistently only produce debug logs when
+--debug is specified.
+
+Upstream-Status: Submitted [https://github.com/nhorman/rng-tools/pull/100]
+
+Signed-off-by: Yann Dirson <yann@blade-group.com>
+---
+ rngd.h | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/rngd.h b/rngd.h
+index 901b6f1..a79ea0f 100644
+--- a/rngd.h
++++ b/rngd.h
+@@ -166,13 +166,13 @@ extern bool quiet;
+ #define message(priority,fmt,args...) do { \
+ 	if (quiet) \
+ 		break;\
++	if (arguments->debug == false && LOG_PRI(priority) == LOG_DEBUG) \
++		break;\
+ 	if (am_daemon) { \
+ 		syslog((priority), fmt, ##args); \
+ 	} else if (!msg_squash) { \
+-		if ((LOG_PRI(priority) != LOG_DEBUG) || (arguments->debug == true)) {\
+-			fprintf(stderr, fmt, ##args); \
+-			fflush(stderr); \
+-		} \
++		fprintf(stderr, fmt, ##args); \
++		fflush(stderr); \
+ 	} \
+ } while (0)
+ 
+-- 
+2.28.0
+
diff --git a/meta/recipes-support/rng-tools/rng-tools_6.10.bb b/meta/recipes-support/rng-tools/rng-tools_6.10.bb
index 3f9720e406..40ec5ad671 100644
--- a/meta/recipes-support/rng-tools/rng-tools_6.10.bb
+++ b/meta/recipes-support/rng-tools/rng-tools_6.10.bb
@@ -12,6 +12,7 @@ SRC_URI = "\
     git://github.com/nhorman/rng-tools.git \
     file://a4b6d9ce64f132e463b9091d0536913ddaf11516.patch \
     file://dab16a5fd4efde8ef569b358e19b1fcbc7d0d938.patch \
+    file://0001-rngd-fix-debug-to-also-filter-syslog-calls.patch \
     file://init \
     file://default \
     file://rngd.service \
-- 
2.28.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-09 13:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-09 13:35 [PATCH v2] rngd: fix --debug to also filter syslog() calls Yann Dirson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.