[PATCH] act: fix the logic of parsing actions
Cong Wang
xiyou.wangcong at gmail.com
Mon Apr 14 18:39:08 PDT 2014
It is proved that actions are not always put from 0,
they could be discontinuous.
Signed-off-by: Cong Wang <xiyou.wangcong at gmail.com>
---
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 3141866..a2ca335 100644
--- a/lib/route/act.c
+++ b/lib/route/act.c
@@ -390,10 +390,13 @@ 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_act *act;
struct rtnl_tc *tc;
+ if (nla[i] == NULL)
+ continue;
+
act = rtnl_act_alloc();
if (!act) {
err = -NLE_NOMEM;
--
1.8.3.1
More information about the libnl
mailing list