Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Implements a dummy match to allow attaching comments to rules
0004  *
0005  * 2003-05-13 Brad Fisher (brad@info-link.net)
0006  */
0007 
0008 #include <linux/module.h>
0009 #include <linux/skbuff.h>
0010 #include <linux/netfilter/x_tables.h>
0011 #include <linux/netfilter/xt_comment.h>
0012 
0013 MODULE_AUTHOR("Brad Fisher <brad@info-link.net>");
0014 MODULE_DESCRIPTION("Xtables: No-op match which can be tagged with a comment");
0015 MODULE_LICENSE("GPL");
0016 MODULE_ALIAS("ipt_comment");
0017 MODULE_ALIAS("ip6t_comment");
0018 
0019 static bool
0020 comment_mt(const struct sk_buff *skb, struct xt_action_param *par)
0021 {
0022     /* We always match */
0023     return true;
0024 }
0025 
0026 static struct xt_match comment_mt_reg __read_mostly = {
0027     .name      = "comment",
0028     .revision  = 0,
0029     .family    = NFPROTO_UNSPEC,
0030     .match     = comment_mt,
0031     .matchsize = sizeof(struct xt_comment_info),
0032     .me        = THIS_MODULE,
0033 };
0034 
0035 static int __init comment_mt_init(void)
0036 {
0037     return xt_register_match(&comment_mt_reg);
0038 }
0039 
0040 static void __exit comment_mt_exit(void)
0041 {
0042     xt_unregister_match(&comment_mt_reg);
0043 }
0044 
0045 module_init(comment_mt_init);
0046 module_exit(comment_mt_exit);