1 #include <linux/kernel.h>
3 #include <linux/module.h>
6 #include <linux/netfilter.h>
16 #define NF_LOG_PREFIXLEN 128
17 #define NFLOGGER_NAME_LEN 64
23 static struct nf_logger *__find_logger(
int pf,
const char *str_logger)
45 INIT_LIST_HEAD(&logger->
list[i]);
56 lockdep_is_held(&nf_log_mutex));
75 lockdep_is_held(&nf_log_mutex));
76 if (c_logger == logger)
91 if (__find_logger(pf, logger->
name) ==
NULL) {
117 const char *
fmt, ...)
127 vsnprintf(prefix,
sizeof(prefix), fmt, args);
129 logger->
logfn(pf, hooknum, skb, in, out, loginfo, prefix);
135 #ifdef CONFIG_PROC_FS
136 static void *seq_start(
struct seq_file *seq, loff_t *
pos)
146 static void *seq_next(
struct seq_file *
s,
void *
v, loff_t *pos)
156 static void seq_stop(
struct seq_file *s,
void *v)
161 static int seq_show(
struct seq_file *s,
void *v)
169 lockdep_is_held(&nf_log_mutex));
183 if (&t->
list[*pos] != nf_loggers_l[*pos].prev) {
202 return seq_open(file, &nflog_seq_ops);
222 void __user *
buffer,
size_t *lenp, loff_t *ppos)
231 if (size >
sizeof(buf))
236 if (!
strcmp(buf,
"NONE")) {
241 logger = __find_logger(tindex, buf);
242 if (logger ==
NULL) {
251 lockdep_is_held(&nf_log_mutex));
253 table->
data =
"NONE";
263 static __init int netfilter_log_sysctl_init(
void)
269 nf_log_sysctl_table[
i].procname =
271 nf_log_sysctl_table[
i].data =
NULL;
272 nf_log_sysctl_table[
i].maxlen =
274 nf_log_sysctl_table[
i].mode = 0644;
275 nf_log_sysctl_table[
i].proc_handler = nf_log_proc_dostring;
276 nf_log_sysctl_table[
i].extra1 = (
void *)(
unsigned long)
i;
280 nf_log_sysctl_table);
281 if (!nf_log_dir_header)
287 static __init int netfilter_log_sysctl_init(
void)
296 #ifdef CONFIG_PROC_FS
297 if (!proc_create(
"nf_log",
S_IRUGO,
298 proc_net_netfilter, &nflog_file_ops))
303 r = netfilter_log_sysctl_init();
308 INIT_LIST_HEAD(&(nf_loggers_l[i]));