Blame view

net/netfilter/xt_CLASSIFY.c 1.6 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  /*
   * This is a module which is used for setting the skb->priority field
   * of an skb for qdisc classification.
   */
  
  /* (C) 2001-2002 Patrick McHardy <kaber@trash.net>
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
  
  #include <linux/module.h>
  #include <linux/skbuff.h>
  #include <linux/ip.h>
  #include <net/checksum.h>
891350c9d   Patrick McHardy   [NETFILTER]: xt_m...
17
18
  #include <linux/netfilter_ipv4.h>
  #include <linux/netfilter_ipv6.h>
2e4e6a17a   Harald Welte   [NETFILTER] x_tab...
19
20
  #include <linux/netfilter/x_tables.h>
  #include <linux/netfilter/xt_CLASSIFY.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
22
23
  
  MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>");
  MODULE_LICENSE("GPL");
2ae15b64e   Jan Engelhardt   [NETFILTER]: Upda...
24
  MODULE_DESCRIPTION("Xtables: Qdisc classification");
2e4e6a17a   Harald Welte   [NETFILTER] x_tab...
25
  MODULE_ALIAS("ipt_CLASSIFY");
73aaf9355   Jan Engelhardt   [NETFILTER]: x_ta...
26
  MODULE_ALIAS("ip6t_CLASSIFY");
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
27
28
  
  static unsigned int
4b560b447   Jan Engelhardt   netfilter: xtable...
29
  classify_tg(struct sk_buff *skb, const struct xt_action_param *par)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
30
  {
7eb355865   Jan Engelhardt   netfilter: xtable...
31
  	const struct xt_classify_target_info *clinfo = par->targinfo;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
32

3db05fea5   Herbert Xu   [NETFILTER]: Repl...
33
  	skb->priority = clinfo->priority;
2e4e6a17a   Harald Welte   [NETFILTER] x_tab...
34
  	return XT_CONTINUE;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
35
  }
55b69e910   Jan Engelhardt   netfilter: implem...
36
37
38
39
40
41
42
43
44
45
  static struct xt_target classify_tg_reg __read_mostly = {
  	.name       = "CLASSIFY",
  	.revision   = 0,
  	.family     = NFPROTO_UNSPEC,
  	.table      = "mangle",
  	.hooks      = (1 << NF_INET_LOCAL_OUT) | (1 << NF_INET_FORWARD) |
  		      (1 << NF_INET_POST_ROUTING),
  	.target     = classify_tg,
  	.targetsize = sizeof(struct xt_classify_target_info),
  	.me         = THIS_MODULE,
2e4e6a17a   Harald Welte   [NETFILTER] x_tab...
46
  };
2e4e6a17a   Harald Welte   [NETFILTER] x_tab...
47

d3c5ee6d5   Jan Engelhardt   [NETFILTER]: x_ta...
48
  static int __init classify_tg_init(void)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
49
  {
55b69e910   Jan Engelhardt   netfilter: implem...
50
  	return xt_register_target(&classify_tg_reg);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
51
  }
d3c5ee6d5   Jan Engelhardt   [NETFILTER]: x_ta...
52
  static void __exit classify_tg_exit(void)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
53
  {
55b69e910   Jan Engelhardt   netfilter: implem...
54
  	xt_unregister_target(&classify_tg_reg);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
55
  }
d3c5ee6d5   Jan Engelhardt   [NETFILTER]: x_ta...
56
57
  module_init(classify_tg_init);
  module_exit(classify_tg_exit);