xref: /openbmc/linux/net/netfilter/xt_comment.c (revision 09c434b8)
109c434b8SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
22e4e6a17SHarald Welte /*
32e4e6a17SHarald Welte  * Implements a dummy match to allow attaching comments to rules
42e4e6a17SHarald Welte  *
52e4e6a17SHarald Welte  * 2003-05-13 Brad Fisher (brad@info-link.net)
62e4e6a17SHarald Welte  */
72e4e6a17SHarald Welte 
82e4e6a17SHarald Welte #include <linux/module.h>
92e4e6a17SHarald Welte #include <linux/skbuff.h>
102e4e6a17SHarald Welte #include <linux/netfilter/x_tables.h>
112e4e6a17SHarald Welte #include <linux/netfilter/xt_comment.h>
122e4e6a17SHarald Welte 
132e4e6a17SHarald Welte MODULE_AUTHOR("Brad Fisher <brad@info-link.net>");
142ae15b64SJan Engelhardt MODULE_DESCRIPTION("Xtables: No-op match which can be tagged with a comment");
152e4e6a17SHarald Welte MODULE_LICENSE("GPL");
162e4e6a17SHarald Welte MODULE_ALIAS("ipt_comment");
172e4e6a17SHarald Welte MODULE_ALIAS("ip6t_comment");
182e4e6a17SHarald Welte 
191d93a9cbSJan Engelhardt static bool
comment_mt(const struct sk_buff * skb,struct xt_action_param * par)2062fc8051SJan Engelhardt comment_mt(const struct sk_buff *skb, struct xt_action_param *par)
212e4e6a17SHarald Welte {
222e4e6a17SHarald Welte 	/* We always match */
231d93a9cbSJan Engelhardt 	return true;
242e4e6a17SHarald Welte }
252e4e6a17SHarald Welte 
26ab4f21e6SJan Engelhardt static struct xt_match comment_mt_reg __read_mostly = {
272e4e6a17SHarald Welte 	.name      = "comment",
28ab4f21e6SJan Engelhardt 	.revision  = 0,
29ab4f21e6SJan Engelhardt 	.family    = NFPROTO_UNSPEC,
30d3c5ee6dSJan Engelhardt 	.match     = comment_mt,
315d04bff0SPatrick McHardy 	.matchsize = sizeof(struct xt_comment_info),
32ab4f21e6SJan Engelhardt 	.me        = THIS_MODULE,
332e4e6a17SHarald Welte };
342e4e6a17SHarald Welte 
comment_mt_init(void)35d3c5ee6dSJan Engelhardt static int __init comment_mt_init(void)
362e4e6a17SHarald Welte {
37ab4f21e6SJan Engelhardt 	return xt_register_match(&comment_mt_reg);
382e4e6a17SHarald Welte }
392e4e6a17SHarald Welte 
comment_mt_exit(void)40d3c5ee6dSJan Engelhardt static void __exit comment_mt_exit(void)
412e4e6a17SHarald Welte {
42ab4f21e6SJan Engelhardt 	xt_unregister_match(&comment_mt_reg);
432e4e6a17SHarald Welte }
442e4e6a17SHarald Welte 
45d3c5ee6dSJan Engelhardt module_init(comment_mt_init);
46d3c5ee6dSJan Engelhardt module_exit(comment_mt_exit);
47