xt_comment.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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("iptables comment match module");
  12. MODULE_LICENSE("GPL");
  13. MODULE_ALIAS("ipt_comment");
  14. MODULE_ALIAS("ip6t_comment");
  15. static int
  16. match(const struct sk_buff *skb,
  17. const struct net_device *in,
  18. const struct net_device *out,
  19. const struct xt_match *match,
  20. const void *matchinfo,
  21. int offset,
  22. unsigned int protooff,
  23. int *hotdrop)
  24. {
  25. /* We always match */
  26. return 1;
  27. }
  28. static struct xt_match xt_comment_match[] = {
  29. {
  30. .name = "comment",
  31. .family = AF_INET,
  32. .match = match,
  33. .matchsize = sizeof(struct xt_comment_info),
  34. .me = THIS_MODULE
  35. },
  36. {
  37. .name = "comment",
  38. .family = AF_INET6,
  39. .match = match,
  40. .matchsize = sizeof(struct xt_comment_info),
  41. .me = THIS_MODULE
  42. },
  43. };
  44. static int __init xt_comment_init(void)
  45. {
  46. return xt_register_matches(xt_comment_match,
  47. ARRAY_SIZE(xt_comment_match));
  48. }
  49. static void __exit xt_comment_fini(void)
  50. {
  51. xt_unregister_matches(xt_comment_match, ARRAY_SIZE(xt_comment_match));
  52. }
  53. module_init(xt_comment_init);
  54. module_exit(xt_comment_fini);