Root/
1 | /* |
2 | * net/sched/em_u32.c U32 Ematch |
3 | * |
4 | * This program is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU General Public License |
6 | * as published by the Free Software Foundation; either version |
7 | * 2 of the License, or (at your option) any later version. |
8 | * |
9 | * Authors: Thomas Graf <tgraf@suug.ch> |
10 | * Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> |
11 | * |
12 | * Based on net/sched/cls_u32.c |
13 | */ |
14 | |
15 | #include <linux/module.h> |
16 | #include <linux/types.h> |
17 | #include <linux/kernel.h> |
18 | #include <linux/skbuff.h> |
19 | #include <net/pkt_cls.h> |
20 | |
21 | static int em_u32_match(struct sk_buff *skb, struct tcf_ematch *em, |
22 | struct tcf_pkt_info *info) |
23 | { |
24 | struct tc_u32_key *key = (struct tc_u32_key *) em->data; |
25 | const unsigned char *ptr = skb_network_header(skb); |
26 | |
27 | if (info) { |
28 | if (info->ptr) |
29 | ptr = info->ptr; |
30 | ptr += (info->nexthdr & key->offmask); |
31 | } |
32 | |
33 | ptr += key->off; |
34 | |
35 | if (!tcf_valid_offset(skb, ptr, sizeof(u32))) |
36 | return 0; |
37 | |
38 | return !(((*(__be32*) ptr) ^ key->val) & key->mask); |
39 | } |
40 | |
41 | static struct tcf_ematch_ops em_u32_ops = { |
42 | .kind = TCF_EM_U32, |
43 | .datalen = sizeof(struct tc_u32_key), |
44 | .match = em_u32_match, |
45 | .owner = THIS_MODULE, |
46 | .link = LIST_HEAD_INIT(em_u32_ops.link) |
47 | }; |
48 | |
49 | static int __init init_em_u32(void) |
50 | { |
51 | return tcf_em_register(&em_u32_ops); |
52 | } |
53 | |
54 | static void __exit exit_em_u32(void) |
55 | { |
56 | tcf_em_unregister(&em_u32_ops); |
57 | } |
58 | |
59 | MODULE_LICENSE("GPL"); |
60 | |
61 | module_init(init_em_u32); |
62 | module_exit(exit_em_u32); |
63 | |
64 | MODULE_ALIAS_TCF_EMATCH(TCF_EM_U32); |
65 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9