[NETFILTER]: x_tables: add xt_{match,target} arguments to match/target functions
[deliverable/linux.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("[ip,ip6,arp]_tables NFQUEUE target");
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 target(struct sk_buff **pskb,
28 const struct net_device *in,
29 const struct net_device *out,
30 unsigned int hooknum,
31 const struct xt_target *target,
32 const void *targinfo,
33 void *userinfo)
34 {
35 const struct xt_NFQ_info *tinfo = targinfo;
36
37 return NF_QUEUE_NR(tinfo->queuenum);
38 }
39
40 static struct xt_target ipt_NFQ_reg = {
41 .name = "NFQUEUE",
42 .target = target,
43 .targetsize = sizeof(struct xt_NFQ_info),
44 .me = THIS_MODULE,
45 };
46
47 static struct xt_target ip6t_NFQ_reg = {
48 .name = "NFQUEUE",
49 .target = target,
50 .targetsize = sizeof(struct xt_NFQ_info),
51 .me = THIS_MODULE,
52 };
53
54 static struct xt_target arpt_NFQ_reg = {
55 .name = "NFQUEUE",
56 .target = target,
57 .targetsize = sizeof(struct xt_NFQ_info),
58 .me = THIS_MODULE,
59 };
60
61 static int __init init(void)
62 {
63 int ret;
64 ret = xt_register_target(AF_INET, &ipt_NFQ_reg);
65 if (ret)
66 return ret;
67 ret = xt_register_target(AF_INET6, &ip6t_NFQ_reg);
68 if (ret)
69 goto out_ip;
70 ret = xt_register_target(NF_ARP, &arpt_NFQ_reg);
71 if (ret)
72 goto out_ip6;
73
74 return ret;
75 out_ip6:
76 xt_unregister_target(AF_INET6, &ip6t_NFQ_reg);
77 out_ip:
78 xt_unregister_target(AF_INET, &ipt_NFQ_reg);
79
80 return ret;
81 }
82
83 static void __exit fini(void)
84 {
85 xt_unregister_target(NF_ARP, &arpt_NFQ_reg);
86 xt_unregister_target(AF_INET6, &ip6t_NFQ_reg);
87 xt_unregister_target(AF_INET, &ipt_NFQ_reg);
88 }
89
90 module_init(init);
91 module_exit(fini);
This page took 0.043564 seconds and 5 git commands to generate.