[NETFILTER]: Rename init functions.
[linux-2.6.22.y-op.git] / net / ipv4 / netfilter / ipt_tos.c
blob5549c39c78512d63228c04c62362633337c8a5f5
1 /* Kernel module to match TOS values. */
3 /* (C) 1999-2001 Paul `Rusty' Russell
4 * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
11 #include <linux/module.h>
12 #include <linux/skbuff.h>
14 #include <linux/netfilter_ipv4/ipt_tos.h>
15 #include <linux/netfilter_ipv4/ip_tables.h>
17 MODULE_LICENSE("GPL");
18 MODULE_DESCRIPTION("iptables TOS match module");
20 static int
21 match(const struct sk_buff *skb,
22 const struct net_device *in,
23 const struct net_device *out,
24 const struct xt_match *match,
25 const void *matchinfo,
26 int offset,
27 unsigned int protoff,
28 int *hotdrop)
30 const struct ipt_tos_info *info = matchinfo;
32 return (skb->nh.iph->tos == info->tos) ^ info->invert;
35 static struct ipt_match tos_match = {
36 .name = "tos",
37 .match = match,
38 .matchsize = sizeof(struct ipt_tos_info),
39 .me = THIS_MODULE,
42 static int __init ipt_multiport_init(void)
44 return ipt_register_match(&tos_match);
47 static void __exit ipt_multiport_fini(void)
49 ipt_unregister_match(&tos_match);
52 module_init(ipt_multiport_init);
53 module_exit(ipt_multiport_fini);