]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
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> | |
2e4e6a17 HW |
9 | #include <linux/netfilter/x_tables.h> |
10 | #include <linux/netfilter/xt_comment.h> | |
1da177e4 LT |
11 | |
12 | MODULE_AUTHOR("Brad Fisher <brad@info-link.net>"); | |
13 | MODULE_DESCRIPTION("iptables comment match module"); | |
14 | MODULE_LICENSE("GPL"); | |
2e4e6a17 HW |
15 | MODULE_ALIAS("ipt_comment"); |
16 | MODULE_ALIAS("ip6t_comment"); | |
1da177e4 LT |
17 | |
18 | static int | |
19 | match(const struct sk_buff *skb, | |
20 | const struct net_device *in, | |
21 | const struct net_device *out, | |
c4986734 | 22 | const struct xt_match *match, |
1da177e4 LT |
23 | const void *matchinfo, |
24 | int offset, | |
2e4e6a17 | 25 | unsigned int protooff, |
1da177e4 LT |
26 | int *hotdrop) |
27 | { | |
28 | /* We always match */ | |
29 | return 1; | |
30 | } | |
31 | ||
2e4e6a17 HW |
32 | static struct xt_match comment_match = { |
33 | .name = "comment", | |
34 | .match = match, | |
5d04bff0 | 35 | .matchsize = sizeof(struct xt_comment_info), |
a45049c5 | 36 | .family = AF_INET, |
2e4e6a17 HW |
37 | .me = THIS_MODULE |
38 | }; | |
39 | ||
40 | static struct xt_match comment6_match = { | |
1da177e4 LT |
41 | .name = "comment", |
42 | .match = match, | |
5d04bff0 | 43 | .matchsize = sizeof(struct xt_comment_info), |
a45049c5 | 44 | .family = AF_INET6, |
1da177e4 LT |
45 | .me = THIS_MODULE |
46 | }; | |
47 | ||
65b4b4e8 | 48 | static int __init xt_comment_init(void) |
1da177e4 | 49 | { |
2e4e6a17 HW |
50 | int ret; |
51 | ||
a45049c5 | 52 | ret = xt_register_match(&comment_match); |
2e4e6a17 HW |
53 | if (ret) |
54 | return ret; | |
55 | ||
a45049c5 | 56 | ret = xt_register_match(&comment6_match); |
2e4e6a17 | 57 | if (ret) |
a45049c5 | 58 | xt_unregister_match(&comment_match); |
2e4e6a17 HW |
59 | |
60 | return ret; | |
1da177e4 LT |
61 | } |
62 | ||
65b4b4e8 | 63 | static void __exit xt_comment_fini(void) |
1da177e4 | 64 | { |
a45049c5 PNA |
65 | xt_unregister_match(&comment_match); |
66 | xt_unregister_match(&comment6_match); | |
1da177e4 LT |
67 | } |
68 | ||
65b4b4e8 AM |
69 | module_init(xt_comment_init); |
70 | module_exit(xt_comment_fini); |