cls_cgroup.c (c57d5621d2f2dc238f4b9c4d00b2a54187a75445) cls_cgroup.c (b87a173e25d6bf5c26f13d329cdddf57dbd4061a)
1/*
2 * net/sched/cls_cgroup.c Control Group Classifier
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 *

--- 16 unchanged lines hidden (view full) ---

25 struct tcf_proto *tp;
26 struct rcu_head rcu;
27};
28
29static int cls_cgroup_classify(struct sk_buff *skb, const struct tcf_proto *tp,
30 struct tcf_result *res)
31{
32 struct cls_cgroup_head *head = rcu_dereference_bh(tp->root);
1/*
2 * net/sched/cls_cgroup.c Control Group Classifier
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 *

--- 16 unchanged lines hidden (view full) ---

25 struct tcf_proto *tp;
26 struct rcu_head rcu;
27};
28
29static int cls_cgroup_classify(struct sk_buff *skb, const struct tcf_proto *tp,
30 struct tcf_result *res)
31{
32 struct cls_cgroup_head *head = rcu_dereference_bh(tp->root);
33 u32 classid;
33 u32 classid = task_get_classid(skb);
34
34
35 classid = task_cls_state(current)->classid;
36
37 /*
38 * Due to the nature of the classifier it is required to ignore all
39 * packets originating from softirq context as accessing `current'
40 * would lead to false results.
41 *
42 * This test assumes that all callers of dev_queue_xmit() explicitely
43 * disable bh. Knowing this, it is possible to detect softirq based
44 * calls by looking at the number of nested bh disable calls because
45 * softirqs always disables bh.
46 */
47 if (in_serving_softirq()) {
48 /* If there is an sk_classid we'll use that. */
49 if (!skb->sk)
50 return -1;
51 classid = skb->sk->sk_classid;
52 }
53
54 if (!classid)
55 return -1;
35 if (!classid)
36 return -1;
56
57 if (!tcf_em_tree_match(skb, &head->ematches, NULL))
58 return -1;
59
60 res->classid = classid;
61 res->class = 0;
37 if (!tcf_em_tree_match(skb, &head->ematches, NULL))
38 return -1;
39
40 res->classid = classid;
41 res->class = 0;
42
62 return tcf_exts_exec(skb, &head->exts, res);
63}
64
65static unsigned long cls_cgroup_get(struct tcf_proto *tp, u32 handle)
66{
67 return 0UL;
68}
69

--- 164 unchanged lines hidden ---
43 return tcf_exts_exec(skb, &head->exts, res);
44}
45
46static unsigned long cls_cgroup_get(struct tcf_proto *tp, u32 handle)
47{
48 return 0UL;
49}
50

--- 164 unchanged lines hidden ---