Merge with rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[sfrench/cifs-2.6.git] / net / netfilter / xt_comment.c
1 /*
2  * Implements a dummy match to allow attaching comments to rules
3  *
4  * 2003-05-13 Brad Fisher (brad@info-link.net)
5  */
6
7 #include <linux/module.h>
8 #include <linux/skbuff.h>
9 #include <linux/netfilter/x_tables.h>
10 #include <linux/netfilter/xt_comment.h>
11
12 MODULE_AUTHOR("Brad Fisher <brad@info-link.net>");
13 MODULE_DESCRIPTION("iptables comment match module");
14 MODULE_LICENSE("GPL");
15 MODULE_ALIAS("ipt_comment");
16 MODULE_ALIAS("ip6t_comment");
17
18 static int
19 match(const struct sk_buff *skb,
20       const struct net_device *in,
21       const struct net_device *out,
22       const struct xt_match *match,
23       const void *matchinfo,
24       int offset,
25       unsigned int protooff,
26       int *hotdrop)
27 {
28         /* We always match */
29         return 1;
30 }
31
32 static struct xt_match comment_match = {
33         .name           = "comment",
34         .match          = match,
35         .matchsize      = sizeof(struct xt_comment_info),
36         .me             = THIS_MODULE
37 };
38
39 static struct xt_match comment6_match = {
40         .name           = "comment",
41         .match          = match,
42         .matchsize      = sizeof(struct xt_comment_info),
43         .me             = THIS_MODULE
44 };
45
46 static int __init init(void)
47 {
48         int ret;
49
50         ret = xt_register_match(AF_INET, &comment_match);
51         if (ret)
52                 return ret;
53
54         ret = xt_register_match(AF_INET6, &comment6_match);
55         if (ret)
56                 xt_unregister_match(AF_INET, &comment_match);
57
58         return ret;
59 }
60
61 static void __exit fini(void)
62 {
63         xt_unregister_match(AF_INET, &comment_match);
64         xt_unregister_match(AF_INET6, &comment6_match);
65 }
66
67 module_init(init);
68 module_exit(fini);