netfilter: xtables: move extension arguments into compound structure (4/6)
[safe/jmp/linux-2.6] / 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 xt_target_param *par)
28 {
29         const struct xt_NFQ_info *tinfo = par->targinfo;
30
31         return NF_QUEUE_NR(tinfo->queuenum);
32 }
33
34 static struct xt_target nfqueue_tg_reg[] __read_mostly = {
35         {
36                 .name           = "NFQUEUE",
37                 .family         = NFPROTO_IPV4,
38                 .target         = nfqueue_tg,
39                 .targetsize     = sizeof(struct xt_NFQ_info),
40                 .me             = THIS_MODULE,
41         },
42         {
43                 .name           = "NFQUEUE",
44                 .family         = NFPROTO_IPV6,
45                 .target         = nfqueue_tg,
46                 .targetsize     = sizeof(struct xt_NFQ_info),
47                 .me             = THIS_MODULE,
48         },
49         {
50                 .name           = "NFQUEUE",
51                 .family         = NF_ARP,
52                 .target         = nfqueue_tg,
53                 .targetsize     = sizeof(struct xt_NFQ_info),
54                 .me             = THIS_MODULE,
55         },
56 };
57
58 static int __init nfqueue_tg_init(void)
59 {
60         return xt_register_targets(nfqueue_tg_reg, ARRAY_SIZE(nfqueue_tg_reg));
61 }
62
63 static void __exit nfqueue_tg_exit(void)
64 {
65         xt_unregister_targets(nfqueue_tg_reg, ARRAY_SIZE(nfqueue_tg_reg));
66 }
67
68 module_init(nfqueue_tg_init);
69 module_exit(nfqueue_tg_exit);