Commit c661d238 authored by David S. Miller's avatar David S. Miller

[PKT_ACT]: Fixup tcf_result updating wrt. tcf_action_exec() calls.

- 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: default avatarDavid S. Miller <davem@davemloft.net>
parent a24d2389
...@@ -376,7 +376,7 @@ struct tc_action_ops ...@@ -376,7 +376,7 @@ struct tc_action_ops
extern int tcf_register_action(struct tc_action_ops *a); extern int tcf_register_action(struct tc_action_ops *a);
extern int tcf_unregister_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 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(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_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); extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int);
......
...@@ -155,7 +155,7 @@ struct tc_action_ops *tc_lookup_action_id(u32 type) ...@@ -155,7 +155,7 @@ struct tc_action_ops *tc_lookup_action_id(u32 type)
return a; 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; struct tc_action *a;
...@@ -164,7 +164,8 @@ int tcf_action_exec(struct sk_buff *skb,struct tc_action *act) ...@@ -164,7 +164,8 @@ int tcf_action_exec(struct sk_buff *skb,struct tc_action *act)
if (skb->tc_verd & TC_NCLS) { if (skb->tc_verd & TC_NCLS) {
skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); 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); 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) { while ((a = act) != NULL) {
repeat: repeat:
...@@ -186,6 +187,11 @@ int tcf_action_exec(struct sk_buff *skb,struct tc_action *act) ...@@ -186,6 +187,11 @@ int tcf_action_exec(struct sk_buff *skb,struct tc_action *act)
} }
exec_done: exec_done:
if (skb->tc_classid > 0) {
res->classid = skb->tc_classid;
res->class = 0;
skb->tc_classid = 0;
}
return ret; return ret;
} }
......
...@@ -102,7 +102,7 @@ static int fw_classify(struct sk_buff *skb, struct tcf_proto *tp, ...@@ -102,7 +102,7 @@ static int fw_classify(struct sk_buff *skb, struct tcf_proto *tp,
} }
#endif #endif
if (f->action) { 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) if (pol_res >= 0)
return pol_res; return pol_res;
} else } else
......
...@@ -175,12 +175,7 @@ static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_re ...@@ -175,12 +175,7 @@ static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_re
#endif #endif
#ifdef CONFIG_NET_CLS_ACT #ifdef CONFIG_NET_CLS_ACT
if (n->action) { if (n->action) {
int pol_res = tcf_action_exec(skb, n->action); int pol_res = tcf_action_exec(skb, n->action, res);
if (skb->tc_classid > 0) {
res->classid = skb->tc_classid;
skb->tc_classid = 0;
}
if (pol_res >= 0) if (pol_res >= 0)
return pol_res; return pol_res;
} else } else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment