- if (tb[TCA_FW_CLASSID-1]) {
- unsigned long cl;
-
- f->res.classid = *(u32*)RTA_DATA(tb[TCA_FW_CLASSID-1]);
- cl = tp->q->ops->cl_ops->bind_tcf(tp->q, base, f->res.classid);
- cl = cls_set_class(tp, &f->res.class, cl);
- if (cl)
- tp->q->ops->cl_ops->unbind_tcf(tp->q, cl);
- }
-#ifdef CONFIG_NET_CLS_ACT
- if (tb[TCA_FW_POLICE-1]) {
- act = kmalloc(sizeof(*act),GFP_KERNEL);
- if (NULL == act)
- return -ENOMEM;
-
- memset(act,0,sizeof(*act));
- ret = tcf_action_init_1(tb[TCA_FW_POLICE-1], tca[TCA_RATE-1] ,act,"police",TCA_ACT_NOREPLACE,TCA_ACT_BIND);
- if (0 > ret){
- tcf_action_destroy(act,TCA_ACT_UNBIND);
- return ret;
- }
- act->type = TCA_OLD_COMPAT;
-
- sch_tree_lock(tp->q);
- act = xchg(&f->action, act);
- sch_tree_unlock(tp->q);
-
- tcf_action_destroy(act,TCA_ACT_UNBIND);
-
- }
-
- if(tb[TCA_FW_ACT-1]) {
- act = kmalloc(sizeof(*act),GFP_KERNEL);
- if (NULL == act)
- return -ENOMEM;
- memset(act,0,sizeof(*act));
- ret = tcf_action_init(tb[TCA_FW_ACT-1], tca[TCA_RATE-1],act,NULL, TCA_ACT_NOREPLACE,TCA_ACT_BIND);
- if (0 > ret) {
- tcf_action_destroy(act,TCA_ACT_UNBIND);
- return ret;
- }
-
- sch_tree_lock(tp->q);
- act = xchg(&f->action, act);
- sch_tree_unlock(tp->q);
-
- tcf_action_destroy(act,TCA_ACT_UNBIND);
- }
-#ifdef CONFIG_NET_CLS_IND
- if(tb[TCA_FW_INDEV-1]) {
- struct rtattr *idev = tb[TCA_FW_INDEV-1];
- if (RTA_PAYLOAD(idev) >= IFNAMSIZ) {
- printk("cls_fw: bad indev name %s\n",(char*)RTA_DATA(idev));
- err = -EINVAL;
- goto errout;
- }
- memset(f->indev,0,IFNAMSIZ);
- sprintf(f->indev, "%s", (char*)RTA_DATA(idev));
- }
-#endif
-#else /* only POLICE defined */
-#ifdef CONFIG_NET_CLS_POLICE
- if (tb[TCA_FW_POLICE-1]) {
- struct tcf_police *police = tcf_police_locate(tb[TCA_FW_POLICE-1], tca[TCA_RATE-1]);
-
- tcf_tree_lock(tp);
- police = xchg(&f->police, police);
- tcf_tree_unlock(tp);
-
- tcf_police_release(police,TCA_ACT_UNBIND);
- }
-#endif
-#endif
- return 0;