The route-table code is useful outside the scope of Open vSwitch. In a subsequent patch we will expose the route-table data structures to allow projects compiling against the private Open vSwitch library to consume this data.
The rtnetlink rtmsg rtm_table variable can hold route table IDs no higher than UCHAR_MAX. Use the rtnetlink RTA_TABLE route attribute for table IDs larger than UCHAR_MAX, which can represent a 32 bit integer worth of route tables. Signed-off-by: Frode Nordahl <[email protected]> --- lib/route-table.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/route-table.c b/lib/route-table.c index 4e5f89f7e..1ba323f2a 100644 --- a/lib/route-table.c +++ b/lib/route-table.c @@ -198,7 +198,7 @@ route_table_wait(void) } static bool -route_table_dump_one_table(unsigned char id) +route_table_dump_one_table(uint32_t id) { uint64_t reply_stub[NL_DUMP_BUFSIZE / 8]; struct ofpbuf request, reply, buf; @@ -212,7 +212,13 @@ route_table_dump_one_table(unsigned char id) rq_msg = ofpbuf_put_zeros(&request, sizeof *rq_msg); rq_msg->rtm_family = AF_UNSPEC; - rq_msg->rtm_table = id; + + if (id > UCHAR_MAX) { + rq_msg->rtm_table = RT_TABLE_UNSPEC; + nl_msg_put_u32(&request, RTA_TABLE, id); + } else { + rq_msg->rtm_table = id; + } nl_dump_start(&dump, NETLINK_ROUTE, &request); ofpbuf_uninit(&request); @@ -241,7 +247,7 @@ route_table_dump_one_table(unsigned char id) static void route_table_reset(void) { - unsigned char tables[] = { + uint32_t tables[] = { RT_TABLE_DEFAULT, RT_TABLE_MAIN, RT_TABLE_LOCAL, -- 2.45.2 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
