forked from Minki/linux
pkt_sched: Stop using NLA_PUT*().
These macros contain a hidden goto, and are thus extremely error prone and make code hard to audit. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9360ffd185
commit
1b34ec43c9
@ -127,7 +127,8 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a,
|
|||||||
nest = nla_nest_start(skb, a->order);
|
nest = nla_nest_start(skb, a->order);
|
||||||
if (nest == NULL)
|
if (nest == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
NLA_PUT_STRING(skb, TCA_KIND, a->ops->kind);
|
if (nla_put_string(skb, TCA_KIND, a->ops->kind))
|
||||||
|
goto nla_put_failure;
|
||||||
for (i = 0; i < (hinfo->hmask + 1); i++) {
|
for (i = 0; i < (hinfo->hmask + 1); i++) {
|
||||||
p = hinfo->htab[tcf_hash(i, hinfo->hmask)];
|
p = hinfo->htab[tcf_hash(i, hinfo->hmask)];
|
||||||
|
|
||||||
@ -139,7 +140,8 @@ static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a,
|
|||||||
p = s_p;
|
p = s_p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NLA_PUT_U32(skb, TCA_FCNT, n_i);
|
if (nla_put_u32(skb, TCA_FCNT, n_i))
|
||||||
|
goto nla_put_failure;
|
||||||
nla_nest_end(skb, nest);
|
nla_nest_end(skb, nest);
|
||||||
|
|
||||||
return n_i;
|
return n_i;
|
||||||
@ -437,7 +439,8 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
|
|||||||
if (a->ops == NULL || a->ops->dump == NULL)
|
if (a->ops == NULL || a->ops->dump == NULL)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
NLA_PUT_STRING(skb, TCA_KIND, a->ops->kind);
|
if (nla_put_string(skb, TCA_KIND, a->ops->kind))
|
||||||
|
goto nla_put_failure;
|
||||||
if (tcf_action_copy_stats(skb, a, 0))
|
if (tcf_action_copy_stats(skb, a, 0))
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
nest = nla_nest_start(skb, TCA_OPTIONS);
|
nest = nla_nest_start(skb, TCA_OPTIONS);
|
||||||
|
@ -550,11 +550,13 @@ static int tcf_csum_dump(struct sk_buff *skb,
|
|||||||
};
|
};
|
||||||
struct tcf_t t;
|
struct tcf_t t;
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_CSUM_PARMS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_CSUM_PARMS, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
|
t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
|
||||||
t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
|
t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
|
||||||
t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
|
t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
|
||||||
NLA_PUT(skb, TCA_CSUM_TM, sizeof(t), &t);
|
if (nla_put(skb, TCA_CSUM_TM, sizeof(t), &t))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
|
@ -162,7 +162,8 @@ static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int
|
|||||||
};
|
};
|
||||||
struct tcf_t t;
|
struct tcf_t t;
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_GACT_PARMS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_GACT_PARMS, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
#ifdef CONFIG_GACT_PROB
|
#ifdef CONFIG_GACT_PROB
|
||||||
if (gact->tcfg_ptype) {
|
if (gact->tcfg_ptype) {
|
||||||
struct tc_gact_p p_opt = {
|
struct tc_gact_p p_opt = {
|
||||||
@ -171,13 +172,15 @@ static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int
|
|||||||
.ptype = gact->tcfg_ptype,
|
.ptype = gact->tcfg_ptype,
|
||||||
};
|
};
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_GACT_PROB, sizeof(p_opt), &p_opt);
|
if (nla_put(skb, TCA_GACT_PROB, sizeof(p_opt), &p_opt))
|
||||||
|
goto nla_put_failure;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install);
|
t.install = jiffies_to_clock_t(jiffies - gact->tcf_tm.install);
|
||||||
t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse);
|
t.lastuse = jiffies_to_clock_t(jiffies - gact->tcf_tm.lastuse);
|
||||||
t.expires = jiffies_to_clock_t(gact->tcf_tm.expires);
|
t.expires = jiffies_to_clock_t(gact->tcf_tm.expires);
|
||||||
NLA_PUT(skb, TCA_GACT_TM, sizeof(t), &t);
|
if (nla_put(skb, TCA_GACT_TM, sizeof(t), &t))
|
||||||
|
goto nla_put_failure;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -267,15 +267,17 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int
|
|||||||
c.refcnt = ipt->tcf_refcnt - ref;
|
c.refcnt = ipt->tcf_refcnt - ref;
|
||||||
strcpy(t->u.user.name, ipt->tcfi_t->u.kernel.target->name);
|
strcpy(t->u.user.name, ipt->tcfi_t->u.kernel.target->name);
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_IPT_TARG, ipt->tcfi_t->u.user.target_size, t);
|
if (nla_put(skb, TCA_IPT_TARG, ipt->tcfi_t->u.user.target_size, t) ||
|
||||||
NLA_PUT_U32(skb, TCA_IPT_INDEX, ipt->tcf_index);
|
nla_put_u32(skb, TCA_IPT_INDEX, ipt->tcf_index) ||
|
||||||
NLA_PUT_U32(skb, TCA_IPT_HOOK, ipt->tcfi_hook);
|
nla_put_u32(skb, TCA_IPT_HOOK, ipt->tcfi_hook) ||
|
||||||
NLA_PUT(skb, TCA_IPT_CNT, sizeof(struct tc_cnt), &c);
|
nla_put(skb, TCA_IPT_CNT, sizeof(struct tc_cnt), &c) ||
|
||||||
NLA_PUT_STRING(skb, TCA_IPT_TABLE, ipt->tcfi_tname);
|
nla_put_string(skb, TCA_IPT_TABLE, ipt->tcfi_tname))
|
||||||
|
goto nla_put_failure;
|
||||||
tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install);
|
tm.install = jiffies_to_clock_t(jiffies - ipt->tcf_tm.install);
|
||||||
tm.lastuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.lastuse);
|
tm.lastuse = jiffies_to_clock_t(jiffies - ipt->tcf_tm.lastuse);
|
||||||
tm.expires = jiffies_to_clock_t(ipt->tcf_tm.expires);
|
tm.expires = jiffies_to_clock_t(ipt->tcf_tm.expires);
|
||||||
NLA_PUT(skb, TCA_IPT_TM, sizeof (tm), &tm);
|
if (nla_put(skb, TCA_IPT_TM, sizeof (tm), &tm))
|
||||||
|
goto nla_put_failure;
|
||||||
kfree(t);
|
kfree(t);
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
|
@ -227,11 +227,13 @@ static int tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, i
|
|||||||
};
|
};
|
||||||
struct tcf_t t;
|
struct tcf_t t;
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_MIRRED_PARMS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_MIRRED_PARMS, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
t.install = jiffies_to_clock_t(jiffies - m->tcf_tm.install);
|
t.install = jiffies_to_clock_t(jiffies - m->tcf_tm.install);
|
||||||
t.lastuse = jiffies_to_clock_t(jiffies - m->tcf_tm.lastuse);
|
t.lastuse = jiffies_to_clock_t(jiffies - m->tcf_tm.lastuse);
|
||||||
t.expires = jiffies_to_clock_t(m->tcf_tm.expires);
|
t.expires = jiffies_to_clock_t(m->tcf_tm.expires);
|
||||||
NLA_PUT(skb, TCA_MIRRED_TM, sizeof(t), &t);
|
if (nla_put(skb, TCA_MIRRED_TM, sizeof(t), &t))
|
||||||
|
goto nla_put_failure;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -284,11 +284,13 @@ static int tcf_nat_dump(struct sk_buff *skb, struct tc_action *a,
|
|||||||
};
|
};
|
||||||
struct tcf_t t;
|
struct tcf_t t;
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_NAT_PARMS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_NAT_PARMS, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
|
t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
|
||||||
t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
|
t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
|
||||||
t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
|
t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
|
||||||
NLA_PUT(skb, TCA_NAT_TM, sizeof(t), &t);
|
if (nla_put(skb, TCA_NAT_TM, sizeof(t), &t))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
|
@ -215,11 +215,13 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,
|
|||||||
opt->refcnt = p->tcf_refcnt - ref;
|
opt->refcnt = p->tcf_refcnt - ref;
|
||||||
opt->bindcnt = p->tcf_bindcnt - bind;
|
opt->bindcnt = p->tcf_bindcnt - bind;
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_PEDIT_PARMS, s, opt);
|
if (nla_put(skb, TCA_PEDIT_PARMS, s, opt))
|
||||||
|
goto nla_put_failure;
|
||||||
t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
|
t.install = jiffies_to_clock_t(jiffies - p->tcf_tm.install);
|
||||||
t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
|
t.lastuse = jiffies_to_clock_t(jiffies - p->tcf_tm.lastuse);
|
||||||
t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
|
t.expires = jiffies_to_clock_t(p->tcf_tm.expires);
|
||||||
NLA_PUT(skb, TCA_PEDIT_TM, sizeof(t), &t);
|
if (nla_put(skb, TCA_PEDIT_TM, sizeof(t), &t))
|
||||||
|
goto nla_put_failure;
|
||||||
kfree(opt);
|
kfree(opt);
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
|
@ -356,11 +356,14 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
|
|||||||
opt.rate = police->tcfp_R_tab->rate;
|
opt.rate = police->tcfp_R_tab->rate;
|
||||||
if (police->tcfp_P_tab)
|
if (police->tcfp_P_tab)
|
||||||
opt.peakrate = police->tcfp_P_tab->rate;
|
opt.peakrate = police->tcfp_P_tab->rate;
|
||||||
NLA_PUT(skb, TCA_POLICE_TBF, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_POLICE_TBF, sizeof(opt), &opt))
|
||||||
if (police->tcfp_result)
|
goto nla_put_failure;
|
||||||
NLA_PUT_U32(skb, TCA_POLICE_RESULT, police->tcfp_result);
|
if (police->tcfp_result &&
|
||||||
if (police->tcfp_ewma_rate)
|
nla_put_u32(skb, TCA_POLICE_RESULT, police->tcfp_result))
|
||||||
NLA_PUT_U32(skb, TCA_POLICE_AVRATE, police->tcfp_ewma_rate);
|
goto nla_put_failure;
|
||||||
|
if (police->tcfp_ewma_rate &&
|
||||||
|
nla_put_u32(skb, TCA_POLICE_AVRATE, police->tcfp_ewma_rate))
|
||||||
|
goto nla_put_failure;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -172,12 +172,14 @@ static int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a,
|
|||||||
};
|
};
|
||||||
struct tcf_t t;
|
struct tcf_t t;
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_DEF_PARMS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_DEF_PARMS, sizeof(opt), &opt) ||
|
||||||
NLA_PUT_STRING(skb, TCA_DEF_DATA, d->tcfd_defdata);
|
nla_put_string(skb, TCA_DEF_DATA, d->tcfd_defdata))
|
||||||
|
goto nla_put_failure;
|
||||||
t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
|
t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
|
||||||
t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse);
|
t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse);
|
||||||
t.expires = jiffies_to_clock_t(d->tcf_tm.expires);
|
t.expires = jiffies_to_clock_t(d->tcf_tm.expires);
|
||||||
NLA_PUT(skb, TCA_DEF_TM, sizeof(t), &t);
|
if (nla_put(skb, TCA_DEF_TM, sizeof(t), &t))
|
||||||
|
goto nla_put_failure;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -166,20 +166,25 @@ static int tcf_skbedit_dump(struct sk_buff *skb, struct tc_action *a,
|
|||||||
};
|
};
|
||||||
struct tcf_t t;
|
struct tcf_t t;
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_SKBEDIT_PARMS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_SKBEDIT_PARMS, sizeof(opt), &opt))
|
||||||
if (d->flags & SKBEDIT_F_PRIORITY)
|
goto nla_put_failure;
|
||||||
NLA_PUT(skb, TCA_SKBEDIT_PRIORITY, sizeof(d->priority),
|
if ((d->flags & SKBEDIT_F_PRIORITY) &&
|
||||||
&d->priority);
|
nla_put(skb, TCA_SKBEDIT_PRIORITY, sizeof(d->priority),
|
||||||
if (d->flags & SKBEDIT_F_QUEUE_MAPPING)
|
&d->priority))
|
||||||
NLA_PUT(skb, TCA_SKBEDIT_QUEUE_MAPPING,
|
goto nla_put_failure;
|
||||||
sizeof(d->queue_mapping), &d->queue_mapping);
|
if ((d->flags & SKBEDIT_F_QUEUE_MAPPING) &&
|
||||||
if (d->flags & SKBEDIT_F_MARK)
|
nla_put(skb, TCA_SKBEDIT_QUEUE_MAPPING,
|
||||||
NLA_PUT(skb, TCA_SKBEDIT_MARK, sizeof(d->mark),
|
sizeof(d->queue_mapping), &d->queue_mapping))
|
||||||
&d->mark);
|
goto nla_put_failure;
|
||||||
|
if ((d->flags & SKBEDIT_F_MARK) &&
|
||||||
|
nla_put(skb, TCA_SKBEDIT_MARK, sizeof(d->mark),
|
||||||
|
&d->mark))
|
||||||
|
goto nla_put_failure;
|
||||||
t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
|
t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
|
||||||
t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse);
|
t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse);
|
||||||
t.expires = jiffies_to_clock_t(d->tcf_tm.expires);
|
t.expires = jiffies_to_clock_t(d->tcf_tm.expires);
|
||||||
NLA_PUT(skb, TCA_SKBEDIT_TM, sizeof(t), &t);
|
if (nla_put(skb, TCA_SKBEDIT_TM, sizeof(t), &t))
|
||||||
|
goto nla_put_failure;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -357,7 +357,8 @@ static int tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp,
|
|||||||
tcm->tcm_ifindex = qdisc_dev(tp->q)->ifindex;
|
tcm->tcm_ifindex = qdisc_dev(tp->q)->ifindex;
|
||||||
tcm->tcm_parent = tp->classid;
|
tcm->tcm_parent = tp->classid;
|
||||||
tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol);
|
tcm->tcm_info = TC_H_MAKE(tp->prio, tp->protocol);
|
||||||
NLA_PUT_STRING(skb, TCA_KIND, tp->ops->kind);
|
if (nla_put_string(skb, TCA_KIND, tp->ops->kind))
|
||||||
|
goto nla_put_failure;
|
||||||
tcm->tcm_handle = fh;
|
tcm->tcm_handle = fh;
|
||||||
if (RTM_DELTFILTER != event) {
|
if (RTM_DELTFILTER != event) {
|
||||||
tcm->tcm_handle = 0;
|
tcm->tcm_handle = 0;
|
||||||
|
@ -257,8 +257,9 @@ static int basic_dump(struct tcf_proto *tp, unsigned long fh,
|
|||||||
if (nest == NULL)
|
if (nest == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (f->res.classid)
|
if (f->res.classid &&
|
||||||
NLA_PUT_U32(skb, TCA_BASIC_CLASSID, f->res.classid);
|
nla_put_u32(skb, TCA_BASIC_CLASSID, f->res.classid))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (tcf_exts_dump(skb, &f->exts, &basic_ext_map) < 0 ||
|
if (tcf_exts_dump(skb, &f->exts, &basic_ext_map) < 0 ||
|
||||||
tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0)
|
tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0)
|
||||||
|
@ -572,25 +572,32 @@ static int flow_dump(struct tcf_proto *tp, unsigned long fh,
|
|||||||
if (nest == NULL)
|
if (nest == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
NLA_PUT_U32(skb, TCA_FLOW_KEYS, f->keymask);
|
if (nla_put_u32(skb, TCA_FLOW_KEYS, f->keymask) ||
|
||||||
NLA_PUT_U32(skb, TCA_FLOW_MODE, f->mode);
|
nla_put_u32(skb, TCA_FLOW_MODE, f->mode))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (f->mask != ~0 || f->xor != 0) {
|
if (f->mask != ~0 || f->xor != 0) {
|
||||||
NLA_PUT_U32(skb, TCA_FLOW_MASK, f->mask);
|
if (nla_put_u32(skb, TCA_FLOW_MASK, f->mask) ||
|
||||||
NLA_PUT_U32(skb, TCA_FLOW_XOR, f->xor);
|
nla_put_u32(skb, TCA_FLOW_XOR, f->xor))
|
||||||
|
goto nla_put_failure;
|
||||||
}
|
}
|
||||||
if (f->rshift)
|
if (f->rshift &&
|
||||||
NLA_PUT_U32(skb, TCA_FLOW_RSHIFT, f->rshift);
|
nla_put_u32(skb, TCA_FLOW_RSHIFT, f->rshift))
|
||||||
if (f->addend)
|
goto nla_put_failure;
|
||||||
NLA_PUT_U32(skb, TCA_FLOW_ADDEND, f->addend);
|
if (f->addend &&
|
||||||
|
nla_put_u32(skb, TCA_FLOW_ADDEND, f->addend))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (f->divisor)
|
if (f->divisor &&
|
||||||
NLA_PUT_U32(skb, TCA_FLOW_DIVISOR, f->divisor);
|
nla_put_u32(skb, TCA_FLOW_DIVISOR, f->divisor))
|
||||||
if (f->baseclass)
|
goto nla_put_failure;
|
||||||
NLA_PUT_U32(skb, TCA_FLOW_BASECLASS, f->baseclass);
|
if (f->baseclass &&
|
||||||
|
nla_put_u32(skb, TCA_FLOW_BASECLASS, f->baseclass))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (f->perturb_period)
|
if (f->perturb_period &&
|
||||||
NLA_PUT_U32(skb, TCA_FLOW_PERTURB, f->perturb_period / HZ);
|
nla_put_u32(skb, TCA_FLOW_PERTURB, f->perturb_period / HZ))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (tcf_exts_dump(skb, &f->exts, &flow_ext_map) < 0)
|
if (tcf_exts_dump(skb, &f->exts, &flow_ext_map) < 0)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
@ -346,14 +346,17 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh,
|
|||||||
if (nest == NULL)
|
if (nest == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (f->res.classid)
|
if (f->res.classid &&
|
||||||
NLA_PUT_U32(skb, TCA_FW_CLASSID, f->res.classid);
|
nla_put_u32(skb, TCA_FW_CLASSID, f->res.classid))
|
||||||
|
goto nla_put_failure;
|
||||||
#ifdef CONFIG_NET_CLS_IND
|
#ifdef CONFIG_NET_CLS_IND
|
||||||
if (strlen(f->indev))
|
if (strlen(f->indev) &&
|
||||||
NLA_PUT_STRING(skb, TCA_FW_INDEV, f->indev);
|
nla_put_string(skb, TCA_FW_INDEV, f->indev))
|
||||||
|
goto nla_put_failure;
|
||||||
#endif /* CONFIG_NET_CLS_IND */
|
#endif /* CONFIG_NET_CLS_IND */
|
||||||
if (head->mask != 0xFFFFFFFF)
|
if (head->mask != 0xFFFFFFFF &&
|
||||||
NLA_PUT_U32(skb, TCA_FW_MASK, head->mask);
|
nla_put_u32(skb, TCA_FW_MASK, head->mask))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0)
|
if (tcf_exts_dump(skb, &f->exts, &fw_ext_map) < 0)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
@ -571,17 +571,21 @@ static int route4_dump(struct tcf_proto *tp, unsigned long fh,
|
|||||||
|
|
||||||
if (!(f->handle & 0x8000)) {
|
if (!(f->handle & 0x8000)) {
|
||||||
id = f->id & 0xFF;
|
id = f->id & 0xFF;
|
||||||
NLA_PUT_U32(skb, TCA_ROUTE4_TO, id);
|
if (nla_put_u32(skb, TCA_ROUTE4_TO, id))
|
||||||
|
goto nla_put_failure;
|
||||||
}
|
}
|
||||||
if (f->handle & 0x80000000) {
|
if (f->handle & 0x80000000) {
|
||||||
if ((f->handle >> 16) != 0xFFFF)
|
if ((f->handle >> 16) != 0xFFFF &&
|
||||||
NLA_PUT_U32(skb, TCA_ROUTE4_IIF, f->iif);
|
nla_put_u32(skb, TCA_ROUTE4_IIF, f->iif))
|
||||||
|
goto nla_put_failure;
|
||||||
} else {
|
} else {
|
||||||
id = f->id >> 16;
|
id = f->id >> 16;
|
||||||
NLA_PUT_U32(skb, TCA_ROUTE4_FROM, id);
|
if (nla_put_u32(skb, TCA_ROUTE4_FROM, id))
|
||||||
|
goto nla_put_failure;
|
||||||
}
|
}
|
||||||
if (f->res.classid)
|
if (f->res.classid &&
|
||||||
NLA_PUT_U32(skb, TCA_ROUTE4_CLASSID, f->res.classid);
|
nla_put_u32(skb, TCA_ROUTE4_CLASSID, f->res.classid))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0)
|
if (tcf_exts_dump(skb, &f->exts, &route_ext_map) < 0)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
@ -615,18 +615,22 @@ static int rsvp_dump(struct tcf_proto *tp, unsigned long fh,
|
|||||||
if (nest == NULL)
|
if (nest == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_RSVP_DST, sizeof(s->dst), &s->dst);
|
if (nla_put(skb, TCA_RSVP_DST, sizeof(s->dst), &s->dst))
|
||||||
|
goto nla_put_failure;
|
||||||
pinfo.dpi = s->dpi;
|
pinfo.dpi = s->dpi;
|
||||||
pinfo.spi = f->spi;
|
pinfo.spi = f->spi;
|
||||||
pinfo.protocol = s->protocol;
|
pinfo.protocol = s->protocol;
|
||||||
pinfo.tunnelid = s->tunnelid;
|
pinfo.tunnelid = s->tunnelid;
|
||||||
pinfo.tunnelhdr = f->tunnelhdr;
|
pinfo.tunnelhdr = f->tunnelhdr;
|
||||||
pinfo.pad = 0;
|
pinfo.pad = 0;
|
||||||
NLA_PUT(skb, TCA_RSVP_PINFO, sizeof(pinfo), &pinfo);
|
if (nla_put(skb, TCA_RSVP_PINFO, sizeof(pinfo), &pinfo))
|
||||||
if (f->res.classid)
|
goto nla_put_failure;
|
||||||
NLA_PUT_U32(skb, TCA_RSVP_CLASSID, f->res.classid);
|
if (f->res.classid &&
|
||||||
if (((f->handle >> 8) & 0xFF) != 16)
|
nla_put_u32(skb, TCA_RSVP_CLASSID, f->res.classid))
|
||||||
NLA_PUT(skb, TCA_RSVP_SRC, sizeof(f->src), f->src);
|
goto nla_put_failure;
|
||||||
|
if (((f->handle >> 8) & 0xFF) != 16 &&
|
||||||
|
nla_put(skb, TCA_RSVP_SRC, sizeof(f->src), f->src))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0)
|
if (tcf_exts_dump(skb, &f->exts, &rsvp_ext_map) < 0)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
@ -438,10 +438,11 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
|
|||||||
|
|
||||||
if (!fh) {
|
if (!fh) {
|
||||||
t->tcm_handle = ~0; /* whatever ... */
|
t->tcm_handle = ~0; /* whatever ... */
|
||||||
NLA_PUT_U32(skb, TCA_TCINDEX_HASH, p->hash);
|
if (nla_put_u32(skb, TCA_TCINDEX_HASH, p->hash) ||
|
||||||
NLA_PUT_U16(skb, TCA_TCINDEX_MASK, p->mask);
|
nla_put_u16(skb, TCA_TCINDEX_MASK, p->mask) ||
|
||||||
NLA_PUT_U32(skb, TCA_TCINDEX_SHIFT, p->shift);
|
nla_put_u32(skb, TCA_TCINDEX_SHIFT, p->shift) ||
|
||||||
NLA_PUT_U32(skb, TCA_TCINDEX_FALL_THROUGH, p->fall_through);
|
nla_put_u32(skb, TCA_TCINDEX_FALL_THROUGH, p->fall_through))
|
||||||
|
goto nla_put_failure;
|
||||||
nla_nest_end(skb, nest);
|
nla_nest_end(skb, nest);
|
||||||
} else {
|
} else {
|
||||||
if (p->perfect) {
|
if (p->perfect) {
|
||||||
@ -460,8 +461,9 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pr_debug("handle = %d\n", t->tcm_handle);
|
pr_debug("handle = %d\n", t->tcm_handle);
|
||||||
if (r->res.class)
|
if (r->res.class &&
|
||||||
NLA_PUT_U32(skb, TCA_TCINDEX_CLASSID, r->res.classid);
|
nla_put_u32(skb, TCA_TCINDEX_CLASSID, r->res.classid))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0)
|
if (tcf_exts_dump(skb, &r->exts, &tcindex_ext_map) < 0)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
@ -733,36 +733,44 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh,
|
|||||||
struct tc_u_hnode *ht = (struct tc_u_hnode *)fh;
|
struct tc_u_hnode *ht = (struct tc_u_hnode *)fh;
|
||||||
u32 divisor = ht->divisor + 1;
|
u32 divisor = ht->divisor + 1;
|
||||||
|
|
||||||
NLA_PUT_U32(skb, TCA_U32_DIVISOR, divisor);
|
if (nla_put_u32(skb, TCA_U32_DIVISOR, divisor))
|
||||||
|
goto nla_put_failure;
|
||||||
} else {
|
} else {
|
||||||
NLA_PUT(skb, TCA_U32_SEL,
|
if (nla_put(skb, TCA_U32_SEL,
|
||||||
sizeof(n->sel) + n->sel.nkeys*sizeof(struct tc_u32_key),
|
sizeof(n->sel) + n->sel.nkeys*sizeof(struct tc_u32_key),
|
||||||
&n->sel);
|
&n->sel))
|
||||||
|
goto nla_put_failure;
|
||||||
if (n->ht_up) {
|
if (n->ht_up) {
|
||||||
u32 htid = n->handle & 0xFFFFF000;
|
u32 htid = n->handle & 0xFFFFF000;
|
||||||
NLA_PUT_U32(skb, TCA_U32_HASH, htid);
|
if (nla_put_u32(skb, TCA_U32_HASH, htid))
|
||||||
|
goto nla_put_failure;
|
||||||
}
|
}
|
||||||
if (n->res.classid)
|
if (n->res.classid &&
|
||||||
NLA_PUT_U32(skb, TCA_U32_CLASSID, n->res.classid);
|
nla_put_u32(skb, TCA_U32_CLASSID, n->res.classid))
|
||||||
if (n->ht_down)
|
goto nla_put_failure;
|
||||||
NLA_PUT_U32(skb, TCA_U32_LINK, n->ht_down->handle);
|
if (n->ht_down &&
|
||||||
|
nla_put_u32(skb, TCA_U32_LINK, n->ht_down->handle))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
#ifdef CONFIG_CLS_U32_MARK
|
#ifdef CONFIG_CLS_U32_MARK
|
||||||
if (n->mark.val || n->mark.mask)
|
if ((n->mark.val || n->mark.mask) &&
|
||||||
NLA_PUT(skb, TCA_U32_MARK, sizeof(n->mark), &n->mark);
|
nla_put(skb, TCA_U32_MARK, sizeof(n->mark), &n->mark))
|
||||||
|
goto nla_put_failure;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (tcf_exts_dump(skb, &n->exts, &u32_ext_map) < 0)
|
if (tcf_exts_dump(skb, &n->exts, &u32_ext_map) < 0)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
#ifdef CONFIG_NET_CLS_IND
|
#ifdef CONFIG_NET_CLS_IND
|
||||||
if (strlen(n->indev))
|
if (strlen(n->indev) &&
|
||||||
NLA_PUT_STRING(skb, TCA_U32_INDEV, n->indev);
|
nla_put_string(skb, TCA_U32_INDEV, n->indev))
|
||||||
|
goto nla_put_failure;
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_CLS_U32_PERF
|
#ifdef CONFIG_CLS_U32_PERF
|
||||||
NLA_PUT(skb, TCA_U32_PCNT,
|
if (nla_put(skb, TCA_U32_PCNT,
|
||||||
sizeof(struct tc_u32_pcnt) + n->sel.nkeys*sizeof(u64),
|
sizeof(struct tc_u32_pcnt) + n->sel.nkeys*sizeof(u64),
|
||||||
n->pf);
|
n->pf))
|
||||||
|
goto nla_put_failure;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,8 +585,9 @@ static void meta_var_apply_extras(struct meta_value *v,
|
|||||||
|
|
||||||
static int meta_var_dump(struct sk_buff *skb, struct meta_value *v, int tlv)
|
static int meta_var_dump(struct sk_buff *skb, struct meta_value *v, int tlv)
|
||||||
{
|
{
|
||||||
if (v->val && v->len)
|
if (v->val && v->len &&
|
||||||
NLA_PUT(skb, tlv, v->len, (void *) v->val);
|
nla_put(skb, tlv, v->len, (void *) v->val))
|
||||||
|
goto nla_put_failure;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
@ -636,10 +637,13 @@ static void meta_int_apply_extras(struct meta_value *v,
|
|||||||
|
|
||||||
static int meta_int_dump(struct sk_buff *skb, struct meta_value *v, int tlv)
|
static int meta_int_dump(struct sk_buff *skb, struct meta_value *v, int tlv)
|
||||||
{
|
{
|
||||||
if (v->len == sizeof(unsigned long))
|
if (v->len == sizeof(unsigned long)) {
|
||||||
NLA_PUT(skb, tlv, sizeof(unsigned long), &v->val);
|
if (nla_put(skb, tlv, sizeof(unsigned long), &v->val))
|
||||||
else if (v->len == sizeof(u32))
|
goto nla_put_failure;
|
||||||
NLA_PUT_U32(skb, tlv, v->val);
|
} else if (v->len == sizeof(u32)) {
|
||||||
|
if (nla_put_u32(skb, tlv, v->val))
|
||||||
|
goto nla_put_failure;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -831,7 +835,8 @@ static int em_meta_dump(struct sk_buff *skb, struct tcf_ematch *em)
|
|||||||
memcpy(&hdr.left, &meta->lvalue.hdr, sizeof(hdr.left));
|
memcpy(&hdr.left, &meta->lvalue.hdr, sizeof(hdr.left));
|
||||||
memcpy(&hdr.right, &meta->rvalue.hdr, sizeof(hdr.right));
|
memcpy(&hdr.right, &meta->rvalue.hdr, sizeof(hdr.right));
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_EM_META_HDR, sizeof(hdr), &hdr);
|
if (nla_put(skb, TCA_EM_META_HDR, sizeof(hdr), &hdr))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
ops = meta_type_ops(&meta->lvalue);
|
ops = meta_type_ops(&meta->lvalue);
|
||||||
if (ops->dump(skb, &meta->lvalue, TCA_EM_META_LVALUE) < 0 ||
|
if (ops->dump(skb, &meta->lvalue, TCA_EM_META_LVALUE) < 0 ||
|
||||||
|
@ -441,7 +441,8 @@ int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv)
|
|||||||
if (top_start == NULL)
|
if (top_start == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr);
|
if (nla_put(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
list_start = nla_nest_start(skb, TCA_EMATCH_TREE_LIST);
|
list_start = nla_nest_start(skb, TCA_EMATCH_TREE_LIST);
|
||||||
if (list_start == NULL)
|
if (list_start == NULL)
|
||||||
@ -457,7 +458,8 @@ int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv)
|
|||||||
.flags = em->flags
|
.flags = em->flags
|
||||||
};
|
};
|
||||||
|
|
||||||
NLA_PUT(skb, i + 1, sizeof(em_hdr), &em_hdr);
|
if (nla_put(skb, i + 1, sizeof(em_hdr), &em_hdr))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (em->ops && em->ops->dump) {
|
if (em->ops && em->ops->dump) {
|
||||||
if (em->ops->dump(skb, em) < 0)
|
if (em->ops->dump(skb, em) < 0)
|
||||||
|
@ -426,7 +426,8 @@ static int qdisc_dump_stab(struct sk_buff *skb, struct qdisc_size_table *stab)
|
|||||||
nest = nla_nest_start(skb, TCA_STAB);
|
nest = nla_nest_start(skb, TCA_STAB);
|
||||||
if (nest == NULL)
|
if (nest == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
NLA_PUT(skb, TCA_STAB_BASE, sizeof(stab->szopts), &stab->szopts);
|
if (nla_put(skb, TCA_STAB_BASE, sizeof(stab->szopts), &stab->szopts))
|
||||||
|
goto nla_put_failure;
|
||||||
nla_nest_end(skb, nest);
|
nla_nest_end(skb, nest);
|
||||||
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
@ -1201,7 +1202,8 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
|
|||||||
tcm->tcm_parent = clid;
|
tcm->tcm_parent = clid;
|
||||||
tcm->tcm_handle = q->handle;
|
tcm->tcm_handle = q->handle;
|
||||||
tcm->tcm_info = atomic_read(&q->refcnt);
|
tcm->tcm_info = atomic_read(&q->refcnt);
|
||||||
NLA_PUT_STRING(skb, TCA_KIND, q->ops->id);
|
if (nla_put_string(skb, TCA_KIND, q->ops->id))
|
||||||
|
goto nla_put_failure;
|
||||||
if (q->ops->dump && q->ops->dump(q, skb) < 0)
|
if (q->ops->dump && q->ops->dump(q, skb) < 0)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
q->qstats.qlen = q->q.qlen;
|
q->qstats.qlen = q->q.qlen;
|
||||||
@ -1505,7 +1507,8 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q,
|
|||||||
tcm->tcm_parent = q->handle;
|
tcm->tcm_parent = q->handle;
|
||||||
tcm->tcm_handle = q->handle;
|
tcm->tcm_handle = q->handle;
|
||||||
tcm->tcm_info = 0;
|
tcm->tcm_info = 0;
|
||||||
NLA_PUT_STRING(skb, TCA_KIND, q->ops->id);
|
if (nla_put_string(skb, TCA_KIND, q->ops->id))
|
||||||
|
goto nla_put_failure;
|
||||||
if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0)
|
if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
|
@ -601,7 +601,8 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
|
|||||||
if (nest == NULL)
|
if (nest == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_ATM_HDR, flow->hdr_len, flow->hdr);
|
if (nla_put(skb, TCA_ATM_HDR, flow->hdr_len, flow->hdr))
|
||||||
|
goto nla_put_failure;
|
||||||
if (flow->vcc) {
|
if (flow->vcc) {
|
||||||
struct sockaddr_atmpvc pvc;
|
struct sockaddr_atmpvc pvc;
|
||||||
int state;
|
int state;
|
||||||
@ -610,15 +611,19 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,
|
|||||||
pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1;
|
pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number : -1;
|
||||||
pvc.sap_addr.vpi = flow->vcc->vpi;
|
pvc.sap_addr.vpi = flow->vcc->vpi;
|
||||||
pvc.sap_addr.vci = flow->vcc->vci;
|
pvc.sap_addr.vci = flow->vcc->vci;
|
||||||
NLA_PUT(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc);
|
if (nla_put(skb, TCA_ATM_ADDR, sizeof(pvc), &pvc))
|
||||||
|
goto nla_put_failure;
|
||||||
state = ATM_VF2VS(flow->vcc->flags);
|
state = ATM_VF2VS(flow->vcc->flags);
|
||||||
NLA_PUT_U32(skb, TCA_ATM_STATE, state);
|
if (nla_put_u32(skb, TCA_ATM_STATE, state))
|
||||||
|
goto nla_put_failure;
|
||||||
|
}
|
||||||
|
if (flow->excess) {
|
||||||
|
if (nla_put_u32(skb, TCA_ATM_EXCESS, flow->classid))
|
||||||
|
goto nla_put_failure;
|
||||||
|
} else {
|
||||||
|
if (nla_put_u32(skb, TCA_ATM_EXCESS, 0))
|
||||||
|
goto nla_put_failure;
|
||||||
}
|
}
|
||||||
if (flow->excess)
|
|
||||||
NLA_PUT_U32(skb, TCA_ATM_EXCESS, flow->classid);
|
|
||||||
else
|
|
||||||
NLA_PUT_U32(skb, TCA_ATM_EXCESS, 0);
|
|
||||||
|
|
||||||
nla_nest_end(skb, nest);
|
nla_nest_end(skb, nest);
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
|
@ -1425,7 +1425,8 @@ static int cbq_dump_rate(struct sk_buff *skb, struct cbq_class *cl)
|
|||||||
{
|
{
|
||||||
unsigned char *b = skb_tail_pointer(skb);
|
unsigned char *b = skb_tail_pointer(skb);
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_CBQ_RATE, sizeof(cl->R_tab->rate), &cl->R_tab->rate);
|
if (nla_put(skb, TCA_CBQ_RATE, sizeof(cl->R_tab->rate), &cl->R_tab->rate))
|
||||||
|
goto nla_put_failure;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
@ -1450,7 +1451,8 @@ static int cbq_dump_lss(struct sk_buff *skb, struct cbq_class *cl)
|
|||||||
opt.minidle = (u32)(-cl->minidle);
|
opt.minidle = (u32)(-cl->minidle);
|
||||||
opt.offtime = cl->offtime;
|
opt.offtime = cl->offtime;
|
||||||
opt.change = ~0;
|
opt.change = ~0;
|
||||||
NLA_PUT(skb, TCA_CBQ_LSSOPT, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_CBQ_LSSOPT, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
@ -1468,7 +1470,8 @@ static int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl)
|
|||||||
opt.priority = cl->priority + 1;
|
opt.priority = cl->priority + 1;
|
||||||
opt.cpriority = cl->cpriority + 1;
|
opt.cpriority = cl->cpriority + 1;
|
||||||
opt.weight = cl->weight;
|
opt.weight = cl->weight;
|
||||||
NLA_PUT(skb, TCA_CBQ_WRROPT, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_CBQ_WRROPT, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
@ -1485,7 +1488,8 @@ static int cbq_dump_ovl(struct sk_buff *skb, struct cbq_class *cl)
|
|||||||
opt.priority2 = cl->priority2 + 1;
|
opt.priority2 = cl->priority2 + 1;
|
||||||
opt.pad = 0;
|
opt.pad = 0;
|
||||||
opt.penalty = cl->penalty;
|
opt.penalty = cl->penalty;
|
||||||
NLA_PUT(skb, TCA_CBQ_OVL_STRATEGY, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_CBQ_OVL_STRATEGY, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
@ -1502,7 +1506,8 @@ static int cbq_dump_fopt(struct sk_buff *skb, struct cbq_class *cl)
|
|||||||
opt.split = cl->split ? cl->split->common.classid : 0;
|
opt.split = cl->split ? cl->split->common.classid : 0;
|
||||||
opt.defmap = cl->defmap;
|
opt.defmap = cl->defmap;
|
||||||
opt.defchange = ~0;
|
opt.defchange = ~0;
|
||||||
NLA_PUT(skb, TCA_CBQ_FOPT, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_CBQ_FOPT, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
}
|
}
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
@ -1521,7 +1526,8 @@ static int cbq_dump_police(struct sk_buff *skb, struct cbq_class *cl)
|
|||||||
opt.police = cl->police;
|
opt.police = cl->police;
|
||||||
opt.__res1 = 0;
|
opt.__res1 = 0;
|
||||||
opt.__res2 = 0;
|
opt.__res2 = 0;
|
||||||
NLA_PUT(skb, TCA_CBQ_POLICE, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_CBQ_POLICE, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
}
|
}
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
|
@ -515,8 +515,9 @@ static int choke_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
if (opts == NULL)
|
if (opts == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_CHOKE_PARMS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_CHOKE_PARMS, sizeof(opt), &opt) ||
|
||||||
NLA_PUT_U32(skb, TCA_CHOKE_MAX_P, q->parms.max_P);
|
nla_put_u32(skb, TCA_CHOKE_MAX_P, q->parms.max_P))
|
||||||
|
goto nla_put_failure;
|
||||||
return nla_nest_end(skb, opts);
|
return nla_nest_end(skb, opts);
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -260,7 +260,8 @@ static int drr_dump_class(struct Qdisc *sch, unsigned long arg,
|
|||||||
nest = nla_nest_start(skb, TCA_OPTIONS);
|
nest = nla_nest_start(skb, TCA_OPTIONS);
|
||||||
if (nest == NULL)
|
if (nest == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
NLA_PUT_U32(skb, TCA_DRR_QUANTUM, cl->quantum);
|
if (nla_put_u32(skb, TCA_DRR_QUANTUM, cl->quantum))
|
||||||
|
goto nla_put_failure;
|
||||||
return nla_nest_end(skb, nest);
|
return nla_nest_end(skb, nest);
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -429,8 +429,9 @@ static int dsmark_dump_class(struct Qdisc *sch, unsigned long cl,
|
|||||||
opts = nla_nest_start(skb, TCA_OPTIONS);
|
opts = nla_nest_start(skb, TCA_OPTIONS);
|
||||||
if (opts == NULL)
|
if (opts == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
NLA_PUT_U8(skb, TCA_DSMARK_MASK, p->mask[cl - 1]);
|
if (nla_put_u8(skb, TCA_DSMARK_MASK, p->mask[cl - 1]) ||
|
||||||
NLA_PUT_U8(skb, TCA_DSMARK_VALUE, p->value[cl - 1]);
|
nla_put_u8(skb, TCA_DSMARK_VALUE, p->value[cl - 1]))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
return nla_nest_end(skb, opts);
|
return nla_nest_end(skb, opts);
|
||||||
|
|
||||||
@ -447,13 +448,16 @@ static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
opts = nla_nest_start(skb, TCA_OPTIONS);
|
opts = nla_nest_start(skb, TCA_OPTIONS);
|
||||||
if (opts == NULL)
|
if (opts == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
NLA_PUT_U16(skb, TCA_DSMARK_INDICES, p->indices);
|
if (nla_put_u16(skb, TCA_DSMARK_INDICES, p->indices))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (p->default_index != NO_DEFAULT_INDEX)
|
if (p->default_index != NO_DEFAULT_INDEX &&
|
||||||
NLA_PUT_U16(skb, TCA_DSMARK_DEFAULT_INDEX, p->default_index);
|
nla_put_u16(skb, TCA_DSMARK_DEFAULT_INDEX, p->default_index))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (p->set_tc_index)
|
if (p->set_tc_index &&
|
||||||
NLA_PUT_FLAG(skb, TCA_DSMARK_SET_TC_INDEX);
|
nla_put_flag(skb, TCA_DSMARK_SET_TC_INDEX))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
return nla_nest_end(skb, opts);
|
return nla_nest_end(skb, opts);
|
||||||
|
|
||||||
|
@ -85,7 +85,8 @@ static int fifo_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
{
|
{
|
||||||
struct tc_fifo_qopt opt = { .limit = sch->limit };
|
struct tc_fifo_qopt opt = { .limit = sch->limit };
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -512,7 +512,8 @@ static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb)
|
|||||||
struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS };
|
struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS };
|
||||||
|
|
||||||
memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1);
|
memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1);
|
||||||
NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -521,14 +521,16 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
opts = nla_nest_start(skb, TCA_OPTIONS);
|
opts = nla_nest_start(skb, TCA_OPTIONS);
|
||||||
if (opts == NULL)
|
if (opts == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
NLA_PUT(skb, TCA_GRED_DPS, sizeof(sopt), &sopt);
|
if (nla_put(skb, TCA_GRED_DPS, sizeof(sopt), &sopt))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
for (i = 0; i < MAX_DPs; i++) {
|
for (i = 0; i < MAX_DPs; i++) {
|
||||||
struct gred_sched_data *q = table->tab[i];
|
struct gred_sched_data *q = table->tab[i];
|
||||||
|
|
||||||
max_p[i] = q ? q->parms.max_P : 0;
|
max_p[i] = q ? q->parms.max_P : 0;
|
||||||
}
|
}
|
||||||
NLA_PUT(skb, TCA_GRED_MAX_P, sizeof(max_p), max_p);
|
if (nla_put(skb, TCA_GRED_MAX_P, sizeof(max_p), max_p))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
parms = nla_nest_start(skb, TCA_GRED_PARMS);
|
parms = nla_nest_start(skb, TCA_GRED_PARMS);
|
||||||
if (parms == NULL)
|
if (parms == NULL)
|
||||||
|
@ -1305,7 +1305,8 @@ hfsc_dump_sc(struct sk_buff *skb, int attr, struct internal_sc *sc)
|
|||||||
tsc.m1 = sm2m(sc->sm1);
|
tsc.m1 = sm2m(sc->sm1);
|
||||||
tsc.d = dx2d(sc->dx);
|
tsc.d = dx2d(sc->dx);
|
||||||
tsc.m2 = sm2m(sc->sm2);
|
tsc.m2 = sm2m(sc->sm2);
|
||||||
NLA_PUT(skb, attr, sizeof(tsc), &tsc);
|
if (nla_put(skb, attr, sizeof(tsc), &tsc))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
@ -1573,7 +1574,8 @@ hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
qopt.defcls = q->defcls;
|
qopt.defcls = q->defcls;
|
||||||
NLA_PUT(skb, TCA_OPTIONS, sizeof(qopt), &qopt);
|
if (nla_put(skb, TCA_OPTIONS, sizeof(qopt), &qopt))
|
||||||
|
goto nla_put_failure;
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -1051,7 +1051,8 @@ static int htb_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
nest = nla_nest_start(skb, TCA_OPTIONS);
|
nest = nla_nest_start(skb, TCA_OPTIONS);
|
||||||
if (nest == NULL)
|
if (nest == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
NLA_PUT(skb, TCA_HTB_INIT, sizeof(gopt), &gopt);
|
if (nla_put(skb, TCA_HTB_INIT, sizeof(gopt), &gopt))
|
||||||
|
goto nla_put_failure;
|
||||||
nla_nest_end(skb, nest);
|
nla_nest_end(skb, nest);
|
||||||
|
|
||||||
spin_unlock_bh(root_lock);
|
spin_unlock_bh(root_lock);
|
||||||
@ -1090,7 +1091,8 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
|
|||||||
opt.quantum = cl->quantum;
|
opt.quantum = cl->quantum;
|
||||||
opt.prio = cl->prio;
|
opt.prio = cl->prio;
|
||||||
opt.level = cl->level;
|
opt.level = cl->level;
|
||||||
NLA_PUT(skb, TCA_HTB_PARMS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_HTB_PARMS, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
nla_nest_end(skb, nest);
|
nla_nest_end(skb, nest);
|
||||||
spin_unlock_bh(root_lock);
|
spin_unlock_bh(root_lock);
|
||||||
|
@ -247,7 +247,8 @@ static int mqprio_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
opt.offset[i] = dev->tc_to_txq[i].offset;
|
opt.offset[i] = dev->tc_to_txq[i].offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -284,7 +284,8 @@ static int multiq_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
opt.bands = q->bands;
|
opt.bands = q->bands;
|
||||||
opt.max_bands = q->max_bands;
|
opt.max_bands = q->max_bands;
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
|
@ -834,7 +834,8 @@ static int dump_loss_model(const struct netem_sched_data *q,
|
|||||||
.p23 = q->clg.a5,
|
.p23 = q->clg.a5,
|
||||||
};
|
};
|
||||||
|
|
||||||
NLA_PUT(skb, NETEM_LOSS_GI, sizeof(gi), &gi);
|
if (nla_put(skb, NETEM_LOSS_GI, sizeof(gi), &gi))
|
||||||
|
goto nla_put_failure;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CLG_GILB_ELL: {
|
case CLG_GILB_ELL: {
|
||||||
@ -845,7 +846,8 @@ static int dump_loss_model(const struct netem_sched_data *q,
|
|||||||
.k1 = q->clg.a4,
|
.k1 = q->clg.a4,
|
||||||
};
|
};
|
||||||
|
|
||||||
NLA_PUT(skb, NETEM_LOSS_GE, sizeof(ge), &ge);
|
if (nla_put(skb, NETEM_LOSS_GE, sizeof(ge), &ge))
|
||||||
|
goto nla_put_failure;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -874,26 +876,31 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
qopt.loss = q->loss;
|
qopt.loss = q->loss;
|
||||||
qopt.gap = q->gap;
|
qopt.gap = q->gap;
|
||||||
qopt.duplicate = q->duplicate;
|
qopt.duplicate = q->duplicate;
|
||||||
NLA_PUT(skb, TCA_OPTIONS, sizeof(qopt), &qopt);
|
if (nla_put(skb, TCA_OPTIONS, sizeof(qopt), &qopt))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
cor.delay_corr = q->delay_cor.rho;
|
cor.delay_corr = q->delay_cor.rho;
|
||||||
cor.loss_corr = q->loss_cor.rho;
|
cor.loss_corr = q->loss_cor.rho;
|
||||||
cor.dup_corr = q->dup_cor.rho;
|
cor.dup_corr = q->dup_cor.rho;
|
||||||
NLA_PUT(skb, TCA_NETEM_CORR, sizeof(cor), &cor);
|
if (nla_put(skb, TCA_NETEM_CORR, sizeof(cor), &cor))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
reorder.probability = q->reorder;
|
reorder.probability = q->reorder;
|
||||||
reorder.correlation = q->reorder_cor.rho;
|
reorder.correlation = q->reorder_cor.rho;
|
||||||
NLA_PUT(skb, TCA_NETEM_REORDER, sizeof(reorder), &reorder);
|
if (nla_put(skb, TCA_NETEM_REORDER, sizeof(reorder), &reorder))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
corrupt.probability = q->corrupt;
|
corrupt.probability = q->corrupt;
|
||||||
corrupt.correlation = q->corrupt_cor.rho;
|
corrupt.correlation = q->corrupt_cor.rho;
|
||||||
NLA_PUT(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt);
|
if (nla_put(skb, TCA_NETEM_CORRUPT, sizeof(corrupt), &corrupt))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
rate.rate = q->rate;
|
rate.rate = q->rate;
|
||||||
rate.packet_overhead = q->packet_overhead;
|
rate.packet_overhead = q->packet_overhead;
|
||||||
rate.cell_size = q->cell_size;
|
rate.cell_size = q->cell_size;
|
||||||
rate.cell_overhead = q->cell_overhead;
|
rate.cell_overhead = q->cell_overhead;
|
||||||
NLA_PUT(skb, TCA_NETEM_RATE, sizeof(rate), &rate);
|
if (nla_put(skb, TCA_NETEM_RATE, sizeof(rate), &rate))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
if (dump_loss_model(q, skb) != 0)
|
if (dump_loss_model(q, skb) != 0)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
|
@ -247,7 +247,8 @@ static int prio_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
opt.bands = q->bands;
|
opt.bands = q->bands;
|
||||||
memcpy(&opt.priomap, q->prio2band, TC_PRIO_MAX + 1);
|
memcpy(&opt.priomap, q->prio2band, TC_PRIO_MAX + 1);
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
|
@ -429,8 +429,9 @@ static int qfq_dump_class(struct Qdisc *sch, unsigned long arg,
|
|||||||
nest = nla_nest_start(skb, TCA_OPTIONS);
|
nest = nla_nest_start(skb, TCA_OPTIONS);
|
||||||
if (nest == NULL)
|
if (nest == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
NLA_PUT_U32(skb, TCA_QFQ_WEIGHT, ONE_FP/cl->inv_w);
|
if (nla_put_u32(skb, TCA_QFQ_WEIGHT, ONE_FP/cl->inv_w) ||
|
||||||
NLA_PUT_U32(skb, TCA_QFQ_LMAX, cl->lmax);
|
nla_put_u32(skb, TCA_QFQ_LMAX, cl->lmax))
|
||||||
|
goto nla_put_failure;
|
||||||
return nla_nest_end(skb, nest);
|
return nla_nest_end(skb, nest);
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -272,8 +272,9 @@ static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
opts = nla_nest_start(skb, TCA_OPTIONS);
|
opts = nla_nest_start(skb, TCA_OPTIONS);
|
||||||
if (opts == NULL)
|
if (opts == NULL)
|
||||||
goto nla_put_failure;
|
goto nla_put_failure;
|
||||||
NLA_PUT(skb, TCA_RED_PARMS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_RED_PARMS, sizeof(opt), &opt) ||
|
||||||
NLA_PUT_U32(skb, TCA_RED_MAX_P, q->parms.max_P);
|
nla_put_u32(skb, TCA_RED_MAX_P, q->parms.max_P))
|
||||||
|
goto nla_put_failure;
|
||||||
return nla_nest_end(skb, opts);
|
return nla_nest_end(skb, opts);
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -570,7 +570,8 @@ static int sfb_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
|
|
||||||
sch->qstats.backlog = q->qdisc->qstats.backlog;
|
sch->qstats.backlog = q->qdisc->qstats.backlog;
|
||||||
opts = nla_nest_start(skb, TCA_OPTIONS);
|
opts = nla_nest_start(skb, TCA_OPTIONS);
|
||||||
NLA_PUT(skb, TCA_SFB_PARMS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_SFB_PARMS, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
return nla_nest_end(skb, opts);
|
return nla_nest_end(skb, opts);
|
||||||
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
|
@ -812,7 +812,8 @@ static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
memcpy(&opt.stats, &q->stats, sizeof(opt.stats));
|
memcpy(&opt.stats, &q->stats, sizeof(opt.stats));
|
||||||
opt.flags = q->flags;
|
opt.flags = q->flags;
|
||||||
|
|
||||||
NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
|
||||||
|
@ -359,7 +359,8 @@ static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
memset(&opt.peakrate, 0, sizeof(opt.peakrate));
|
memset(&opt.peakrate, 0, sizeof(opt.peakrate));
|
||||||
opt.mtu = q->mtu;
|
opt.mtu = q->mtu;
|
||||||
opt.buffer = q->buffer;
|
opt.buffer = q->buffer;
|
||||||
NLA_PUT(skb, TCA_TBF_PARMS, sizeof(opt), &opt);
|
if (nla_put(skb, TCA_TBF_PARMS, sizeof(opt), &opt))
|
||||||
|
goto nla_put_failure;
|
||||||
|
|
||||||
nla_nest_end(skb, nest);
|
nla_nest_end(skb, nest);
|
||||||
return skb->len;
|
return skb->len;
|
||||||
|
Loading…
Reference in New Issue
Block a user