[PATCH 5/6] netfilter: print the list of register loggers.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch modifies the proc output to add display of registered
loggers. The content of /proc/net/netfilter/nf_log is modified. Instead
of displaying a protocol per line with format:
	proto:logger
it now displays:
	proto:logger (comma_separated_list_of_loggers)

Signed-off-by: Eric Leblond <eric@xxxxxx>
---
 net/netfilter/nf_log.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index 1655a1f..ee08b62 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -172,13 +172,26 @@ static int seq_show(struct seq_file *s, void *v)
 {
 	loff_t *pos = v;
 	const struct nf_logger *logger;
+	struct nf_logger *t;
+	char loggers_string[256];
+	int len = 256;
 
 	logger = rcu_dereference(nf_loggers[*pos]);
 
+	memset(loggers_string, 0, len);
+	list_for_each_entry(t, &nf_loggers_l[*pos], list[*pos]) {
+		strncat(loggers_string, t->name, len);
+		strncat(loggers_string, ",", 1);
+		len -= strlen(t->name) + 1;
+	}
+	if (strlen(loggers_string))
+		loggers_string[strlen(loggers_string) -1] = 0;
+
 	if (!logger)
-		return seq_printf(s, "%2lld NONE\n", *pos);
+		return seq_printf(s, "%2lld NONE (%s)\n", *pos, loggers_string);
 
-	return seq_printf(s, "%2lld %s\n", *pos, logger->name);
+	return seq_printf(s, "%2lld %s (%s)\n", *pos, logger->name,
+			  loggers_string);
 }
 
 static const struct seq_operations nflog_seq_ops = {
-- 
1.6.1

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux