]> granicus.if.org Git - libnl/commitdiff
missing extended Table attribute for lib/route/
authorRomary Sonrier <romary@sonrier.com>
Sat, 3 Mar 2012 00:46:46 +0000 (01:46 +0100)
committerThomas Graf <tgraf@redhat.com>
Tue, 6 Mar 2012 09:15:30 +0000 (10:15 +0100)
I found a small bug in libnl, about extended table id ( above 256 ).

Signed-off-by: Romary Sonrier <romary@sonrier.com>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
lib/route/route_obj.c
lib/route/rule.c

index d3226338c33f4a2b1c102353808421db67709254..ac634ae6383a3a6169a46dfe25da404a1491271e 100644 (file)
@@ -914,6 +914,9 @@ int rtnl_route_parse(struct nlmsghdr *nlh, struct rtnl_route **result)
                nl_addr_put(src);
        }
 
+       if (tb[RTA_TABLE])
+               rtnl_route_set_table(route, nla_get_u32(tb[RTA_TABLE]));
+
        if (tb[RTA_IIF])
                rtnl_route_set_iif(route, nla_get_u32(tb[RTA_IIF]));
 
index 1a695cd9396e62a27a4b93f7cad431076dfbd690..076ca5115357facde5667d5c68fb7900e0bbc6df 100644 (file)
@@ -383,6 +383,10 @@ static int build_rule_msg(struct rtnl_rule *tmpl, int cmd, int flags,
        if (nlmsg_append(msg, &frh, sizeof(frh), NLMSG_ALIGNTO) < 0)
                goto nla_put_failure;
 
+       /* Additional table attribute replacing the 8bit in the header, was
+        * required to allow more than 256 tables. */
+       NLA_PUT_U32(msg, FRA_TABLE, tmpl->r_table);
+
        if (tmpl->ce_mask & RULE_ATTR_SRC)
                NLA_PUT_ADDR(msg, FRA_SRC, tmpl->r_src);