Commit 15e35860 authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

[PKT_SCHED]: cls_fw: Cleanup fw_classify

Cleans up fw_classify by using the generic routines and
adds a additional but unneeded continue to document that
an action may overrule the filter's match result.
Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 25c787b1
...@@ -84,47 +84,39 @@ static int fw_classify(struct sk_buff *skb, struct tcf_proto *tp, ...@@ -84,47 +84,39 @@ static int fw_classify(struct sk_buff *skb, struct tcf_proto *tp,
u32 id = 0; u32 id = 0;
#endif #endif
if (head == NULL) if (head != NULL) {
goto old_method;
for (f=head->ht[fw_hash(id)]; f; f=f->next) { for (f=head->ht[fw_hash(id)]; f; f=f->next) {
if (f->id == id) { if (f->id == id) {
*res = f->res; *res = f->res;
#ifdef CONFIG_NET_CLS_ACT #ifdef CONFIG_NET_CLS_ACT
#ifdef CONFIG_NET_CLS_IND #ifdef CONFIG_NET_CLS_IND
if (0 != f->indev[0]) { if (!tcf_match_indev(skb, f->indev))
if (NULL == skb->input_dev) {
continue; continue;
} else { #endif /* CONFIG_NET_CLS_IND */
if (0 != strcmp(f->indev, skb->input_dev->name)) { if (f->action) {
int act_res = tcf_action_exec(skb, f->action, res);
if (act_res >= 0)
return act_res;
continue; continue;
} }
} #else /* CONFIG_NET_CLS_ACT */
}
#endif
if (f->action) {
int pol_res = tcf_action_exec(skb, f->action, res);
if (pol_res >= 0)
return pol_res;
} else
#else
#ifdef CONFIG_NET_CLS_POLICE #ifdef CONFIG_NET_CLS_POLICE
if (f->police) if (f->police)
return tcf_police(skb, f->police); return tcf_police(skb, f->police);
#endif #endif /* CONFIG_NET_CLS_POLICE */
#endif #endif /* CONFIG_NET_CLS_ACT */
return 0; return 0;
} }
} }
return -1; } else {
/* old method */
old_method: if (id && (TC_H_MAJ(id) == 0 || !(TC_H_MAJ(id^tp->q->handle)))) {
if (id && (TC_H_MAJ(id) == 0 ||
!(TC_H_MAJ(id^tp->q->handle)))) {
res->classid = id; res->classid = id;
res->class = 0; res->class = 0;
return 0; return 0;
} }
}
return -1; return -1;
} }
......
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