act: fix the logic of parsing actions

It is proved that actions are not always put from 0,
they could be discontinuous.

http://lists.infradead.org/pipermail/libnl/2014-April/001374.html

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Cong Wang 2014-04-14 18:39:08 -07:00 committed by Thomas Haller
parent 872544c0c0
commit 6608cd5d72

View file

@ -396,9 +396,12 @@ int rtnl_act_parse(struct rtnl_act **head, struct nlattr *tb)
if (err < 0)
return err;
for (i = 0; i < TCA_ACT_MAX_PRIO && nla[i]; i++) {
for (i = 0; i < TCA_ACT_MAX_PRIO; i++) {
struct rtnl_tc *tc;
if (nla[i] == NULL)
continue;
act = rtnl_act_alloc();
if (!act) {
err = -NLE_NOMEM;