blob: 201155b316e0a8452c0e986b309c70d8a1ef219e [file] [log] [blame]
Harald Welte2e4e6a12006-01-12 13:30:04 -08001/* 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
YOSHIFUJI Hideaki601e68e2007-02-12 11:15:49 -08006 * it under the terms of the GNU General Public License version 2 as
Harald Welte2e4e6a12006-01-12 13:30:04 -08007 * published by the Free Software Foundation.
YOSHIFUJI Hideaki601e68e2007-02-12 11:15:49 -08008 *
Harald Welte2e4e6a12006-01-12 13:30:04 -08009 */
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
19MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
20MODULE_DESCRIPTION("[ip,ip6,arp]_tables NFQUEUE target");
21MODULE_LICENSE("GPL");
22MODULE_ALIAS("ipt_NFQUEUE");
23MODULE_ALIAS("ip6t_NFQUEUE");
24MODULE_ALIAS("arpt_NFQUEUE");
25
26static unsigned int
27target(struct sk_buff **pskb,
28 const struct net_device *in,
29 const struct net_device *out,
30 unsigned int hooknum,
Patrick McHardyc4986732006-03-20 18:02:56 -080031 const struct xt_target *target,
Patrick McHardyfe1cb102006-08-22 00:35:47 -070032 const void *targinfo)
Harald Welte2e4e6a12006-01-12 13:30:04 -080033{
34 const struct xt_NFQ_info *tinfo = targinfo;
35
36 return NF_QUEUE_NR(tinfo->queuenum);
37}
38
Patrick McHardy4470bbc2006-08-22 00:34:04 -070039static struct xt_target xt_nfqueue_target[] = {
40 {
41 .name = "NFQUEUE",
42 .family = AF_INET,
43 .target = target,
44 .targetsize = sizeof(struct xt_NFQ_info),
45 .me = THIS_MODULE,
46 },
47 {
48 .name = "NFQUEUE",
49 .family = AF_INET6,
50 .target = target,
51 .targetsize = sizeof(struct xt_NFQ_info),
52 .me = THIS_MODULE,
53 },
54 {
55 .name = "NFQUEUE",
56 .family = NF_ARP,
57 .target = target,
58 .targetsize = sizeof(struct xt_NFQ_info),
59 .me = THIS_MODULE,
60 },
Harald Welte2e4e6a12006-01-12 13:30:04 -080061};
62
Andrew Morton65b4b4e2006-03-28 16:37:06 -080063static int __init xt_nfqueue_init(void)
Harald Welte2e4e6a12006-01-12 13:30:04 -080064{
Patrick McHardy4470bbc2006-08-22 00:34:04 -070065 return xt_register_targets(xt_nfqueue_target,
66 ARRAY_SIZE(xt_nfqueue_target));
Harald Welte2e4e6a12006-01-12 13:30:04 -080067}
68
Andrew Morton65b4b4e2006-03-28 16:37:06 -080069static void __exit xt_nfqueue_fini(void)
Harald Welte2e4e6a12006-01-12 13:30:04 -080070{
Patrick McHardyf64ad5b2006-10-12 14:07:52 -070071 xt_unregister_targets(xt_nfqueue_target, ARRAY_SIZE(xt_nfqueue_target));
Harald Welte2e4e6a12006-01-12 13:30:04 -080072}
73
Andrew Morton65b4b4e2006-03-28 16:37:06 -080074module_init(xt_nfqueue_init);
75module_exit(xt_nfqueue_fini);