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,
u32 id = 0;
#endif
if (head == NULL)
goto old_method;
for (f=head->ht[fw_hash(id)]; f; f=f->next) {
if (f->id == id) {
*res = f->res;
if (head != NULL) {
for (f=head->ht[fw_hash(id)]; f; f=f->next) {
if (f->id == id) {
*res = f->res;
#ifdef CONFIG_NET_CLS_ACT
#ifdef CONFIG_NET_CLS_IND
if (0 != f->indev[0]) {
if (NULL == skb->input_dev) {
if (!tcf_match_indev(skb, f->indev))
continue;
#endif /* CONFIG_NET_CLS_IND */
if (f->action) {
int act_res = tcf_action_exec(skb, f->action, res);
if (act_res >= 0)
return act_res;
continue;
} else {
if (0 != strcmp(f->indev, skb->input_dev->name)) {
continue;
}
}
}
#endif
if (f->action) {
int pol_res = tcf_action_exec(skb, f->action, res);
if (pol_res >= 0)
return pol_res;
} else
#else
#else /* CONFIG_NET_CLS_ACT */
#ifdef CONFIG_NET_CLS_POLICE
if (f->police)
return tcf_police(skb, f->police);
#endif
#endif
if (f->police)
return tcf_police(skb, f->police);
#endif /* CONFIG_NET_CLS_POLICE */
#endif /* CONFIG_NET_CLS_ACT */
return 0;
}
}
} else {
/* old method */
if (id && (TC_H_MAJ(id) == 0 || !(TC_H_MAJ(id^tp->q->handle)))) {
res->classid = id;
res->class = 0;
return 0;
}
}
return -1;
old_method:
if (id && (TC_H_MAJ(id) == 0 ||
!(TC_H_MAJ(id^tp->q->handle)))) {
res->classid = id;
res->class = 0;
return 0;
}
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