• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/net/ipv4/netfilter/
1/* Kernel module to match TOS values. */
2
3/* (C) 1999-2001 Paul `Rusty' Russell
4 * (C) 2002-2004 Netfilter Core Team <coreteam@netfilter.org>
5 *
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 */
10
11#include <linux/ip.h>
12#include <linux/module.h>
13#include <linux/skbuff.h>
14
15#include <linux/netfilter_ipv4/ipt_tos.h>
16#include <linux/netfilter/x_tables.h>
17
18MODULE_LICENSE("GPL");
19MODULE_DESCRIPTION("iptables TOS match module");
20
21static int
22match(const struct sk_buff *skb,
23      const struct net_device *in,
24      const struct net_device *out,
25      const struct xt_match *match,
26      const void *matchinfo,
27      int offset,
28      unsigned int protoff,
29      int *hotdrop)
30{
31	const struct ipt_tos_info *info = matchinfo;
32
33	return (ip_hdr(skb)->tos == info->tos) ^ info->invert;
34}
35
36static struct xt_match tos_match = {
37	.name		= "tos",
38	.family		= AF_INET,
39	.match		= match,
40	.matchsize	= sizeof(struct ipt_tos_info),
41	.me		= THIS_MODULE,
42};
43
44static int __init ipt_multiport_init(void)
45{
46	return xt_register_match(&tos_match);
47}
48
49static void __exit ipt_multiport_fini(void)
50{
51	xt_unregister_match(&tos_match);
52}
53
54module_init(ipt_multiport_init);
55module_exit(ipt_multiport_fini);
56