From 965fd78042652693cca1c07efcce2f932b405ca7 Mon Sep 17 00:00:00 2001 From: Romary Sonrier Date: Sat, 3 Mar 2012 01:46:46 +0100 Subject: [PATCH] missing extended Table attribute for lib/route/ I found a small bug in libnl, about extended table id ( above 256 ). Signed-off-by: Romary Sonrier Signed-off-by: Thomas Graf --- lib/route/route_obj.c | 3 +++ lib/route/rule.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/lib/route/route_obj.c b/lib/route/route_obj.c index d322633..ac634ae 100644 --- a/lib/route/route_obj.c +++ b/lib/route/route_obj.c @@ -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])); diff --git a/lib/route/rule.c b/lib/route/rule.c index 1a695cd..076ca51 100644 --- a/lib/route/rule.c +++ b/lib/route/rule.c @@ -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);