Merge branch 'release-2.6.27' of git://git.kernel.org/pub/scm/linux/kernel/git/ak...
[pandora-kernel.git] / net / netfilter / xt_NFQUEUE.c
1 /* iptables module for using new netfilter netlink queue
2  *
3  * (C) 2005 by Harald Welte <laforge@netfilter.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  */
10
11 #include <linux/module.h>
12 #include <linux/skbuff.h>
13
14 #include <linux/netfilter.h>
15 #include <linux/netfilter_arp.h>
16 #include <linux/netfilter/x_tables.h>
17 #include <linux/netfilter/xt_NFQUEUE.h>
18
19 MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
20 MODULE_DESCRIPTION("Xtables: packet forwarding to netlink");
21 MODULE_LICENSE("GPL");
22 MODULE_ALIAS("ipt_NFQUEUE");
23 MODULE_ALIAS("ip6t_NFQUEUE");
24 MODULE_ALIAS("arpt_NFQUEUE");
25
26 static unsigned int
27 nfqueue_tg(struct sk_buff *skb, const struct net_device *in,
28            const struct net_device *out, unsigned int hooknum,
29            const struct xt_target *target, const void *targinfo)
30 {
31         const struct xt_NFQ_info *tinfo = targinfo;
32
33         return NF_QUEUE_NR(tinfo->queuenum);
34 }
35
36 static struct xt_target nfqueue_tg_reg[] __read_mostly = {
37         {
38                 .name           = "NFQUEUE",
39                 .family         = AF_INET,
40                 .target         = nfqueue_tg,
41                 .targetsize     = sizeof(struct xt_NFQ_info),
42                 .me             = THIS_MODULE,
43         },
44         {
45                 .name           = "NFQUEUE",
46                 .family         = AF_INET6,
47                 .target         = nfqueue_tg,
48                 .targetsize     = sizeof(struct xt_NFQ_info),
49                 .me             = THIS_MODULE,
50         },
51         {
52                 .name           = "NFQUEUE",
53                 .family         = NF_ARP,
54                 .target         = nfqueue_tg,
55                 .targetsize     = sizeof(struct xt_NFQ_info),
56                 .me             = THIS_MODULE,
57         },
58 };
59
60 static int __init nfqueue_tg_init(void)
61 {
62         return xt_register_targets(nfqueue_tg_reg, ARRAY_SIZE(nfqueue_tg_reg));
63 }
64
65 static void __exit nfqueue_tg_exit(void)
66 {
67         xt_unregister_targets(nfqueue_tg_reg, ARRAY_SIZE(nfqueue_tg_reg));
68 }
69
70 module_init(nfqueue_tg_init);
71 module_exit(nfqueue_tg_exit);