xt_comment.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Implements a dummy match to allow attaching comments to rules
  4. *
  5. * 2003-05-13 Brad Fisher (brad@info-link.net)
  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. MODULE_AUTHOR("Brad Fisher <brad@info-link.net>");
  12. MODULE_DESCRIPTION("Xtables: No-op match which can be tagged with a comment");
  13. MODULE_LICENSE("GPL");
  14. MODULE_ALIAS("ipt_comment");
  15. MODULE_ALIAS("ip6t_comment");
  16. static bool
  17. comment_mt(const struct sk_buff *skb, struct xt_action_param *par)
  18. {
  19. /* We always match */
  20. return true;
  21. }
  22. static struct xt_match comment_mt_reg __read_mostly = {
  23. .name = "comment",
  24. .revision = 0,
  25. .family = NFPROTO_UNSPEC,
  26. .match = comment_mt,
  27. .matchsize = sizeof(struct xt_comment_info),
  28. .me = THIS_MODULE,
  29. };
  30. static int __init comment_mt_init(void)
  31. {
  32. return xt_register_match(&comment_mt_reg);
  33. }
  34. static void __exit comment_mt_exit(void)
  35. {
  36. xt_unregister_match(&comment_mt_reg);
  37. }
  38. module_init(comment_mt_init);
  39. module_exit(comment_mt_exit);