RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / net / bridge / netfilter / ebt_nflog.c
blob5be68bbcc3419585c99762a549a5fa8f820cdb06
1 /*
2 * ebt_nflog
4 * Author:
5 * Peter Warasin <peter@endian.com>
7 * February, 2008
9 * Based on:
10 * xt_NFLOG.c, (C) 2006 by Patrick McHardy <kaber@trash.net>
11 * ebt_ulog.c, (C) 2004 by Bart De Schuymer <bdschuym@pandora.be>
15 #include <linux/module.h>
16 #include <linux/spinlock.h>
17 #include <linux/netfilter/x_tables.h>
18 #include <linux/netfilter_bridge/ebtables.h>
19 #include <linux/netfilter_bridge/ebt_nflog.h>
20 #include <net/netfilter/nf_log.h>
22 static unsigned int
23 ebt_nflog_tg(struct sk_buff *skb, const struct xt_action_param *par)
25 const struct ebt_nflog_info *info = par->targinfo;
26 struct nf_loginfo li;
28 li.type = NF_LOG_TYPE_ULOG;
29 li.u.ulog.copy_len = info->len;
30 li.u.ulog.group = info->group;
31 li.u.ulog.qthreshold = info->threshold;
33 nf_log_packet(PF_BRIDGE, par->hooknum, skb, par->in, par->out,
34 &li, "%s", info->prefix);
35 return EBT_CONTINUE;
38 static int ebt_nflog_tg_check(const struct xt_tgchk_param *par)
40 struct ebt_nflog_info *info = par->targinfo;
42 if (info->flags & ~EBT_NFLOG_MASK)
43 return -EINVAL;
44 info->prefix[EBT_NFLOG_PREFIX_SIZE - 1] = '\0';
45 return 0;
48 static struct xt_target ebt_nflog_tg_reg __read_mostly = {
49 .name = "nflog",
50 .revision = 0,
51 .family = NFPROTO_BRIDGE,
52 .target = ebt_nflog_tg,
53 .checkentry = ebt_nflog_tg_check,
54 .targetsize = sizeof(struct ebt_nflog_info),
55 .me = THIS_MODULE,
58 static int __init ebt_nflog_init(void)
60 return xt_register_target(&ebt_nflog_tg_reg);
63 static void __exit ebt_nflog_fini(void)
65 xt_unregister_target(&ebt_nflog_tg_reg);
68 module_init(ebt_nflog_init);
69 module_exit(ebt_nflog_fini);
70 MODULE_LICENSE("GPL");
71 MODULE_AUTHOR("Peter Warasin <peter@endian.com>");
72 MODULE_DESCRIPTION("ebtables NFLOG netfilter logging module");