diff options
author | Cong Wang <cwang@twopensource.com> | 2014-04-25 16:54:06 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-04-27 23:42:39 -0400 |
commit | 2f7ef2f8790f5bf53db4fc6b2310943139285827 (patch) | |
tree | f2deb92bec03f3af01b9d7c1bf4dfb7b97760ecf /net/sched/cls_cgroup.c | |
parent | 4940b8cd1bc6d452eaffa442d92a28534850ca78 (diff) |
sched, cls: check if we could overwrite actions when changing a filter
When actions are attached to a filter, they are a part of the filter
itself, so when changing a filter we should allow to overwrite the actions
inside as well.
In my specific case, when I tried to _append_ a new action to an existing
filter which already has an action, I got EEXIST since kernel refused
to overwrite the existing one in kernel.
This patch checks if we are changing the filter checking NLM_F_CREATE flag
(Sigh, filters don't use NLM_F_REPLACE...) and then passes the boolean down
to actions. This fixes the problem above.
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_cgroup.c')
-rw-r--r-- | net/sched/cls_cgroup.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index 8e2158ab551c..cacf01bd04f0 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -83,7 +83,7 @@ static const struct nla_policy cgroup_policy[TCA_CGROUP_MAX + 1] = { | |||
83 | static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb, | 83 | static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb, |
84 | struct tcf_proto *tp, unsigned long base, | 84 | struct tcf_proto *tp, unsigned long base, |
85 | u32 handle, struct nlattr **tca, | 85 | u32 handle, struct nlattr **tca, |
86 | unsigned long *arg) | 86 | unsigned long *arg, bool ovr) |
87 | { | 87 | { |
88 | struct nlattr *tb[TCA_CGROUP_MAX + 1]; | 88 | struct nlattr *tb[TCA_CGROUP_MAX + 1]; |
89 | struct cls_cgroup_head *head = tp->root; | 89 | struct cls_cgroup_head *head = tp->root; |
@@ -119,7 +119,7 @@ static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb, | |||
119 | return err; | 119 | return err; |
120 | 120 | ||
121 | tcf_exts_init(&e, TCA_CGROUP_ACT, TCA_CGROUP_POLICE); | 121 | tcf_exts_init(&e, TCA_CGROUP_ACT, TCA_CGROUP_POLICE); |
122 | err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e); | 122 | err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e, ovr); |
123 | if (err < 0) | 123 | if (err < 0) |
124 | return err; | 124 | return err; |
125 | 125 | ||