Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[safe/jmp/linux-2.6] / net / sched / cls_basic.c
index 0c872a7..4e2bda8 100644 (file)
@@ -35,7 +35,7 @@ struct basic_filter
        struct list_head        link;
 };
 
-static struct tcf_ext_map basic_ext_map = {
+static const struct tcf_ext_map basic_ext_map = {
        .action = TCA_BASIC_ACT,
        .police = TCA_BASIC_POLICE
 };
@@ -102,7 +102,7 @@ static inline void basic_delete_filter(struct tcf_proto *tp,
 
 static void basic_destroy(struct tcf_proto *tp)
 {
-       struct basic_head *head = (struct basic_head *) xchg(&tp->root, NULL);
+       struct basic_head *head = tp->root;
        struct basic_filter *f, *n;
 
        list_for_each_entry_safe(f, n, &head->flist, link) {
@@ -129,6 +129,11 @@ static int basic_delete(struct tcf_proto *tp, unsigned long arg)
        return -ENOENT;
 }
 
+static const struct nla_policy basic_policy[TCA_BASIC_MAX + 1] = {
+       [TCA_BASIC_CLASSID]     = { .type = NLA_U32 },
+       [TCA_BASIC_EMATCHES]    = { .type = NLA_NESTED },
+};
+
 static inline int basic_set_parms(struct tcf_proto *tp, struct basic_filter *f,
                                  unsigned long base, struct nlattr **tb,
                                  struct nlattr *est)
@@ -137,10 +142,6 @@ static inline int basic_set_parms(struct tcf_proto *tp, struct basic_filter *f,
        struct tcf_exts e;
        struct tcf_ematch_tree t;
 
-       if (tb[TCA_BASIC_CLASSID])
-               if (nla_len(tb[TCA_BASIC_CLASSID]) < sizeof(u32))
-                       return err;
-
        err = tcf_exts_validate(tp, tb, est, &e, &basic_ext_map);
        if (err < 0)
                return err;
@@ -174,7 +175,8 @@ static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
        if (tca[TCA_OPTIONS] == NULL)
                return -EINVAL;
 
-       err = nla_parse_nested(tb, TCA_BASIC_MAX, tca[TCA_OPTIONS], NULL);
+       err = nla_parse_nested(tb, TCA_BASIC_MAX, tca[TCA_OPTIONS],
+                              basic_policy);
        if (err < 0)
                return err;