blob: f095557e3ef6f3563883937863716470bb1b3ad9 [file] [log] [blame]
Thomas Gleixner09c434b2019-05-19 13:08:20 +01001// SPDX-License-Identifier: GPL-2.0-only
Harald Welte2e4e6a12006-01-12 13:30:04 -08002/*
3 * Implements a dummy match to allow attaching comments to rules
4 *
5 * 2003-05-13 Brad Fisher (brad@info-link.net)
6 */
7
8#include <linux/module.h>
9#include <linux/skbuff.h>
10#include <linux/netfilter/x_tables.h>
11#include <linux/netfilter/xt_comment.h>
12
13MODULE_AUTHOR("Brad Fisher <brad@info-link.net>");
Jan Engelhardt2ae15b62008-01-14 23:42:28 -080014MODULE_DESCRIPTION("Xtables: No-op match which can be tagged with a comment");
Harald Welte2e4e6a12006-01-12 13:30:04 -080015MODULE_LICENSE("GPL");
16MODULE_ALIAS("ipt_comment");
17MODULE_ALIAS("ip6t_comment");
18
Jan Engelhardt1d93a9c2007-07-07 22:15:35 -070019static bool
Jan Engelhardt62fc8052009-07-07 20:42:08 +020020comment_mt(const struct sk_buff *skb, struct xt_action_param *par)
Harald Welte2e4e6a12006-01-12 13:30:04 -080021{
22 /* We always match */
Jan Engelhardt1d93a9c2007-07-07 22:15:35 -070023 return true;
Harald Welte2e4e6a12006-01-12 13:30:04 -080024}
25
Jan Engelhardtab4f21e2008-10-08 11:35:20 +020026static struct xt_match comment_mt_reg __read_mostly = {
27 .name = "comment",
28 .revision = 0,
29 .family = NFPROTO_UNSPEC,
30 .match = comment_mt,
31 .matchsize = sizeof(struct xt_comment_info),
32 .me = THIS_MODULE,
Harald Welte2e4e6a12006-01-12 13:30:04 -080033};
34
Jan Engelhardtd3c5ee62007-12-04 23:24:03 -080035static int __init comment_mt_init(void)
Harald Welte2e4e6a12006-01-12 13:30:04 -080036{
Jan Engelhardtab4f21e2008-10-08 11:35:20 +020037 return xt_register_match(&comment_mt_reg);
Harald Welte2e4e6a12006-01-12 13:30:04 -080038}
39
Jan Engelhardtd3c5ee62007-12-04 23:24:03 -080040static void __exit comment_mt_exit(void)
Harald Welte2e4e6a12006-01-12 13:30:04 -080041{
Jan Engelhardtab4f21e2008-10-08 11:35:20 +020042 xt_unregister_match(&comment_mt_reg);
Harald Welte2e4e6a12006-01-12 13:30:04 -080043}
44
Jan Engelhardtd3c5ee62007-12-04 23:24:03 -080045module_init(comment_mt_init);
46module_exit(comment_mt_exit);