]> git.hungrycats.org Git - linux/commitdiff
[PKT_ACT]: Fixup tcf_result updating wrt. tcf_action_exec() calls.
authorDavid S. Miller <davem@nuts.davemloft.net>
Sun, 3 Oct 2004 08:01:14 +0000 (01:01 -0700)
committerDavid S. Miller <davem@nuts.davemloft.net>
Sun, 3 Oct 2004 08:01:14 +0000 (01:01 -0700)
- Pass tcf_result into tcf_action_exec()
- Update res->classid and res->class on non-zero
  skb->tc_classid, then reset skb->tc_classid
- Update tcf_action_exec() callers in cls_u32.c
  and cls_fw.c

Based upon a patch by Jamal Hadi Salim <hadi@cyberus.ca>

Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/pkt_sched.h
net/sched/act_api.c
net/sched/cls_fw.c
net/sched/cls_u32.c

index c632d5408275696340aa4cb15497da4a6dcbff33..dab127cc2b1d85df24fa99b38c12e7c05d27489f 100644 (file)
@@ -376,7 +376,7 @@ struct tc_action_ops
 extern int tcf_register_action(struct tc_action_ops *a);
 extern int tcf_unregister_action(struct tc_action_ops *a);
 extern void tcf_action_destroy(struct tc_action *a, int bind);
-extern int tcf_action_exec(struct sk_buff *skb, struct tc_action *a);
+extern int tcf_action_exec(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res);
 extern int tcf_action_init(struct rtattr *rta, struct rtattr *est, struct tc_action *a,char *n, int ovr, int bind);
 extern int tcf_action_init_1(struct rtattr *rta, struct rtattr *est, struct tc_action *a,char *n, int ovr, int bind);
 extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int);
index 58d37d6bd48209f96e071243a10220012e231f63..b189f5a28b393b496c063a6d23d51984ffaa4adb 100644 (file)
@@ -155,7 +155,7 @@ struct tc_action_ops *tc_lookup_action_id(u32 type)
        return a;
 }
 
-int tcf_action_exec(struct sk_buff *skb,struct tc_action *act)
+int tcf_action_exec(struct sk_buff *skb,struct tc_action *act, struct tcf_result *res)
 {
 
        struct tc_action *a;
@@ -164,7 +164,8 @@ int tcf_action_exec(struct sk_buff *skb,struct tc_action *act)
        if (skb->tc_verd & TC_NCLS) {
                skb->tc_verd = CLR_TC_NCLS(skb->tc_verd);
                D2PRINTK("(%p)tcf_action_exec: cleared TC_NCLS in %s out %s\n",skb,skb->input_dev?skb->input_dev->name:"xxx",skb->dev->name);
-               return TC_ACT_OK;
+               ret = TC_ACT_OK;
+               goto exec_done;
        }
        while ((a = act) != NULL) {
 repeat:
@@ -186,6 +187,11 @@ repeat:
        }
 
 exec_done:
+       if (skb->tc_classid > 0) {
+               res->classid = skb->tc_classid;
+               res->class = 0;
+               skb->tc_classid = 0;
+       }
 
        return ret;
 }
index 7ce360d31bfc1454de9443d97965ff999bcc651d..3ef250827a5961488c72e5e92997f8fc8d1ee9e2 100644 (file)
@@ -102,7 +102,7 @@ static int fw_classify(struct sk_buff *skb, struct tcf_proto *tp,
                        }
 #endif
                                if (f->action) {
-                                       int pol_res = tcf_action_exec(skb, f->action);
+                                       int pol_res = tcf_action_exec(skb, f->action, res);
                                        if (pol_res >= 0)
                                                return pol_res;
                                } else
index 30d26d4fe34a90b43fa8bd1fcb4635d7d8d4723b..bfe785eb0f573f67aac799d8e899c57ddc88c792 100644 (file)
@@ -175,12 +175,7 @@ check_terminal:
 #endif
 #ifdef CONFIG_NET_CLS_ACT
                                if (n->action) {
-                                       int pol_res = tcf_action_exec(skb, n->action);
-                                       if (skb->tc_classid > 0) {
-                                               res->classid = skb->tc_classid;
-                                               skb->tc_classid = 0;
-                                       }
-
+                                       int pol_res = tcf_action_exec(skb, n->action, res);
                                        if (pol_res >= 0)
                                                return pol_res;
                                } else