aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/cls_tcindex.c
diff options
context:
space:
mode:
authorCong Wang <cwang@twopensource.com>2014-04-25 16:54:06 -0400
committerDavid S. Miller <davem@davemloft.net>2014-04-27 23:42:39 -0400
commit2f7ef2f8790f5bf53db4fc6b2310943139285827 (patch)
treef2deb92bec03f3af01b9d7c1bf4dfb7b97760ecf /net/sched/cls_tcindex.c
parent4940b8cd1bc6d452eaffa442d92a28534850ca78 (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_tcindex.c')
-rw-r--r--net/sched/cls_tcindex.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index eed8404443d8..d11d0a4fbe34 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -192,7 +192,7 @@ static int
192tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, 192tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
193 u32 handle, struct tcindex_data *p, 193 u32 handle, struct tcindex_data *p,
194 struct tcindex_filter_result *r, struct nlattr **tb, 194 struct tcindex_filter_result *r, struct nlattr **tb,
195 struct nlattr *est) 195 struct nlattr *est, bool ovr)
196{ 196{
197 int err, balloc = 0; 197 int err, balloc = 0;
198 struct tcindex_filter_result new_filter_result, *old_r = r; 198 struct tcindex_filter_result new_filter_result, *old_r = r;
@@ -202,7 +202,7 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base,
202 struct tcf_exts e; 202 struct tcf_exts e;
203 203
204 tcf_exts_init(&e, TCA_TCINDEX_ACT, TCA_TCINDEX_POLICE); 204 tcf_exts_init(&e, TCA_TCINDEX_ACT, TCA_TCINDEX_POLICE);
205 err = tcf_exts_validate(net, tp, tb, est, &e); 205 err = tcf_exts_validate(net, tp, tb, est, &e, ovr);
206 if (err < 0) 206 if (err < 0)
207 return err; 207 return err;
208 208
@@ -331,7 +331,7 @@ errout:
331static int 331static int
332tcindex_change(struct net *net, struct sk_buff *in_skb, 332tcindex_change(struct net *net, struct sk_buff *in_skb,
333 struct tcf_proto *tp, unsigned long base, u32 handle, 333 struct tcf_proto *tp, unsigned long base, u32 handle,
334 struct nlattr **tca, unsigned long *arg) 334 struct nlattr **tca, unsigned long *arg, bool ovr)
335{ 335{
336 struct nlattr *opt = tca[TCA_OPTIONS]; 336 struct nlattr *opt = tca[TCA_OPTIONS];
337 struct nlattr *tb[TCA_TCINDEX_MAX + 1]; 337 struct nlattr *tb[TCA_TCINDEX_MAX + 1];
@@ -351,7 +351,7 @@ tcindex_change(struct net *net, struct sk_buff *in_skb,
351 return err; 351 return err;
352 352
353 return tcindex_set_parms(net, tp, base, handle, p, r, tb, 353 return tcindex_set_parms(net, tp, base, handle, p, r, tb,
354 tca[TCA_RATE]); 354 tca[TCA_RATE], ovr);
355} 355}
356 356
357 357