xt_comment.c revision c49867347404c46f137a261643ed4fce4376f324
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 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 12MODULE_AUTHOR("Brad Fisher <brad@info-link.net>"); 13MODULE_DESCRIPTION("iptables comment match module"); 14MODULE_LICENSE("GPL"); 15MODULE_ALIAS("ipt_comment"); 16MODULE_ALIAS("ip6t_comment"); 17 18static int 19match(const struct sk_buff *skb, 20 const struct net_device *in, 21 const struct net_device *out, 22 const struct xt_match *match, 23 const void *matchinfo, 24 int offset, 25 unsigned int protooff, 26 int *hotdrop) 27{ 28 /* We always match */ 29 return 1; 30} 31 32static struct xt_match comment_match = { 33 .name = "comment", 34 .match = match, 35 .matchsize = sizeof(struct xt_comment_info), 36 .me = THIS_MODULE 37}; 38 39static struct xt_match comment6_match = { 40 .name = "comment", 41 .match = match, 42 .matchsize = sizeof(struct xt_comment_info), 43 .me = THIS_MODULE 44}; 45 46static int __init init(void) 47{ 48 int ret; 49 50 ret = xt_register_match(AF_INET, &comment_match); 51 if (ret) 52 return ret; 53 54 ret = xt_register_match(AF_INET6, &comment6_match); 55 if (ret) 56 xt_unregister_match(AF_INET, &comment_match); 57 58 return ret; 59} 60 61static void __exit fini(void) 62{ 63 xt_unregister_match(AF_INET, &comment_match); 64 xt_unregister_match(AF_INET6, &comment6_match); 65} 66 67module_init(init); 68module_exit(fini); 69