xt_comment.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #include <linux/module.h>
  7. #include <linux/skbuff.h>
  8. #include <linux/netfilter/x_tables.h>
  9. #include <linux/netfilter/xt_comment.h>
  10. MODULE_AUTHOR("Brad Fisher <brad@info-link.net>");
  11. MODULE_DESCRIPTION("Xtables: No-op match which can be tagged with a comment");
  12. MODULE_LICENSE("GPL");
  13. MODULE_ALIAS("ipt_comment");
  14. MODULE_ALIAS("ip6t_comment");
  15. static bool
  16. comment_mt(const struct sk_buff *skb, struct xt_action_param *par)
  17. {
  18. /* We always match */
  19. return true;
  20. }
  21. static struct xt_match comment_mt_reg __read_mostly = {
  22. .name = "comment",
  23. .revision = 0,
  24. .family = NFPROTO_UNSPEC,
  25. .match = comment_mt,
  26. .matchsize = sizeof(struct xt_comment_info),
  27. .me = THIS_MODULE,
  28. };
  29. static int __init comment_mt_init(void)
  30. {
  31. return xt_register_match(&comment_mt_reg);
  32. }
  33. static void __exit comment_mt_exit(void)
  34. {
  35. xt_unregister_match(&comment_mt_reg);
  36. }
  37. module_init(comment_mt_init);
  38. module_exit(comment_mt_exit);