diff options
author | Eric Leblond <eric@inl.fr> | 2009-03-16 09:55:27 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2009-03-16 09:55:27 -0400 |
commit | c7a913cd5535554d6f5d5e1f5ef46c4307cf2afc (patch) | |
tree | b49ec6d00a32abc263a7ebe301b498052b605aae /net | |
parent | ca735b3aaa945626ba65a3e51145bfe4ecd9e222 (diff) |
netfilter: print the list of register loggers
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)
NONE is used as keyword if no logger is used.
Signed-off-by: Eric Leblond <eric@inl.fr>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nf_log.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index a228b5fbcf7c..4fcbcc71aa32 100644 --- a/net/netfilter/nf_log.c +++ b/net/netfilter/nf_log.c | |||
@@ -154,13 +154,37 @@ static int seq_show(struct seq_file *s, void *v) | |||
154 | { | 154 | { |
155 | loff_t *pos = v; | 155 | loff_t *pos = v; |
156 | const struct nf_logger *logger; | 156 | const struct nf_logger *logger; |
157 | struct nf_logger *t; | ||
158 | int ret; | ||
157 | 159 | ||
158 | logger = rcu_dereference(nf_loggers[*pos]); | 160 | logger = rcu_dereference(nf_loggers[*pos]); |
159 | 161 | ||
160 | if (!logger) | 162 | if (!logger) |
161 | return seq_printf(s, "%2lld NONE\n", *pos); | 163 | ret = seq_printf(s, "%2lld NONE (", *pos); |
164 | else | ||
165 | ret = seq_printf(s, "%2lld %s (", *pos, logger->name); | ||
166 | |||
167 | if (ret < 0) | ||
168 | return ret; | ||
169 | |||
170 | mutex_lock(&nf_log_mutex); | ||
171 | list_for_each_entry(t, &nf_loggers_l[*pos], list[*pos]) { | ||
172 | ret = seq_printf(s, "%s", t->name); | ||
173 | if (ret < 0) { | ||
174 | mutex_unlock(&nf_log_mutex); | ||
175 | return ret; | ||
176 | } | ||
177 | if (&t->list[*pos] != nf_loggers_l[*pos].prev) { | ||
178 | ret = seq_printf(s, ","); | ||
179 | if (ret < 0) { | ||
180 | mutex_unlock(&nf_log_mutex); | ||
181 | return ret; | ||
182 | } | ||
183 | } | ||
184 | } | ||
185 | mutex_unlock(&nf_log_mutex); | ||
162 | 186 | ||
163 | return seq_printf(s, "%2lld %s\n", *pos, logger->name); | 187 | return seq_printf(s, ")\n"); |
164 | } | 188 | } |
165 | 189 | ||
166 | static const struct seq_operations nflog_seq_ops = { | 190 | static const struct seq_operations nflog_seq_ops = { |