Linux-2.6.12-rc2
[linux-flexiantxendom0-natty.git] / net / ipv4 / netfilter / ipt_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_ipv4/ip_tables.h>
10 #include <linux/netfilter_ipv4/ipt_comment.h>
11
12 MODULE_AUTHOR("Brad Fisher <brad@info-link.net>");
13 MODULE_DESCRIPTION("iptables comment match module");
14 MODULE_LICENSE("GPL");
15
16 static int
17 match(const struct sk_buff *skb,
18       const struct net_device *in,
19       const struct net_device *out,
20       const void *matchinfo,
21       int offset,
22       int *hotdrop)
23 {
24         /* We always match */
25         return 1;
26 }
27
28 static int
29 checkentry(const char *tablename,
30            const struct ipt_ip *ip,
31            void *matchinfo,
32            unsigned int matchsize,
33            unsigned int hook_mask)
34 {
35         /* Check the size */
36         if (matchsize != IPT_ALIGN(sizeof(struct ipt_comment_info)))
37                 return 0;
38         return 1;
39 }
40
41 static struct ipt_match comment_match = {
42         .name           = "comment",
43         .match          = match,
44         .checkentry     = checkentry,
45         .me             = THIS_MODULE
46 };
47
48 static int __init init(void)
49 {
50         return ipt_register_match(&comment_match);
51 }
52
53 static void __exit fini(void)
54 {
55         ipt_unregister_match(&comment_match);
56 }
57
58 module_init(init);
59 module_exit(fini);