From 6608cd5d7242a8b58e62208e71b6c276434566ec Mon Sep 17 00:00:00 2001 From: Cong Wang Date: Mon, 14 Apr 2014 18:39:08 -0700 Subject: [PATCH] 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 Acked-by: Thomas Graf Signed-off-by: Thomas Haller --- lib/route/act.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/route/act.c b/lib/route/act.c index 0e5d7d1..85ce445 100644 --- a/lib/route/act.c +++ b/lib/route/act.c @@ -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;