From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Leblond Subject: [PATCH 5/7] netfilter: print the list of register loggers. Date: Mon, 9 Feb 2009 22:11:14 +0100 Message-ID: <1234213876-8176-5-git-send-email-eric@inl.fr> References: <49909B3E.0@inl.fr> Cc: netfilter-devel@vger.kernel.org, Eric Leblond To: kaber@trash.net Return-path: Received: from bayen.regit.org ([81.57.69.189]:36911 "EHLO ice-age" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753784AbZBIVLX (ORCPT ); Mon, 9 Feb 2009 16:11:23 -0500 In-Reply-To: <49909B3E.0@inl.fr> Sender: netfilter-devel-owner@vger.kernel.org List-ID: 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 --- net/netfilter/nf_log.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index 1655a1f..fc1deca 100644 --- a/net/netfilter/nf_log.c +++ b/net/netfilter/nf_log.c @@ -172,13 +172,31 @@ static int seq_show(struct seq_file *s, void *v) { loff_t *pos = v; const struct nf_logger *logger; + struct nf_logger *t; + int ret; logger = rcu_dereference(nf_loggers[*pos]); if (!logger) - return seq_printf(s, "%2lld NONE\n", *pos); + ret = seq_printf(s, "%2lld NONE (", *pos); + else + ret = seq_printf(s, "%2lld %s (", *pos, logger->name); + + if (ret < 0) + return ret; + + list_for_each_entry(t, &nf_loggers_l[*pos], list[*pos]) { + ret = seq_printf(s, "%s", t->name); + if (ret < 0) + return ret; + if (&t->list[*pos] != nf_loggers_l[*pos].prev) { + ret = seq_printf(s, ","); + if (ret < 0) + return ret; + } + } - return seq_printf(s, "%2lld %s\n", *pos, logger->name); + return seq_printf(s, ")\n"); } static const struct seq_operations nflog_seq_ops = { -- 1.5.6.3