blob: aa9503ff90ba521dcde36ca17c51ceafb453abd4 [file] [log] [blame]
Harald Welte2e4e6a12006-01-12 13:30:04 -08001/*
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
12MODULE_AUTHOR("Brad Fisher <brad@info-link.net>");
13MODULE_DESCRIPTION("iptables comment match module");
14MODULE_LICENSE("GPL");
15MODULE_ALIAS("ipt_comment");
16MODULE_ALIAS("ip6t_comment");
17
Jan Engelhardt1d93a9c2007-07-07 22:15:35 -070018static bool
Harald Welte2e4e6a12006-01-12 13:30:04 -080019match(const struct sk_buff *skb,
20 const struct net_device *in,
21 const struct net_device *out,
Patrick McHardyc4986732006-03-20 18:02:56 -080022 const struct xt_match *match,
Harald Welte2e4e6a12006-01-12 13:30:04 -080023 const void *matchinfo,
24 int offset,
25 unsigned int protooff,
Jan Engelhardtcff533a2007-07-07 22:15:12 -070026 bool *hotdrop)
Harald Welte2e4e6a12006-01-12 13:30:04 -080027{
28 /* We always match */
Jan Engelhardt1d93a9c2007-07-07 22:15:35 -070029 return true;
Harald Welte2e4e6a12006-01-12 13:30:04 -080030}
31
Patrick McHardy4470bbc2006-08-22 00:34:04 -070032static struct xt_match xt_comment_match[] = {
33 {
34 .name = "comment",
35 .family = AF_INET,
36 .match = match,
37 .matchsize = sizeof(struct xt_comment_info),
38 .me = THIS_MODULE
39 },
40 {
41 .name = "comment",
42 .family = AF_INET6,
43 .match = match,
44 .matchsize = sizeof(struct xt_comment_info),
45 .me = THIS_MODULE
46 },
Harald Welte2e4e6a12006-01-12 13:30:04 -080047};
48
Andrew Morton65b4b4e2006-03-28 16:37:06 -080049static int __init xt_comment_init(void)
Harald Welte2e4e6a12006-01-12 13:30:04 -080050{
Patrick McHardy4470bbc2006-08-22 00:34:04 -070051 return xt_register_matches(xt_comment_match,
52 ARRAY_SIZE(xt_comment_match));
Harald Welte2e4e6a12006-01-12 13:30:04 -080053}
54
Andrew Morton65b4b4e2006-03-28 16:37:06 -080055static void __exit xt_comment_fini(void)
Harald Welte2e4e6a12006-01-12 13:30:04 -080056{
Patrick McHardy4470bbc2006-08-22 00:34:04 -070057 xt_unregister_matches(xt_comment_match, ARRAY_SIZE(xt_comment_match));
Harald Welte2e4e6a12006-01-12 13:30:04 -080058}
59
Andrew Morton65b4b4e2006-03-28 16:37:06 -080060module_init(xt_comment_init);
61module_exit(xt_comment_fini);