On 18 Dec 2024, at 8:55, Frode Nordahl wrote:
> On Fri, Dec 13, 2024 at 2:56 PM Eelco Chaudron <echau...@redhat.com> wrote: >> >> >> >> On 10 Dec 2024, at 23:18, Frode Nordahl wrote: >> >>> 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 256. >>> >>> Use the rtnetlink RTA_TABLE route attribute instead, which can >>> represent a 32 bit integer worth of route tables. >>> >>> Signed-off-by: Frode Nordahl <fnord...@ubuntu.com> >> >> The code looks good to me. However, what does this mean for backward >> compatibility? What is the oldest kernel still supported? > > That is a good point. In the other direction, we store rtm->rtm_table > first, and overwrite it if there is a RTA_TABLE attribute. > > We could probably do something similar in this direction, as in using > rtm->rtm_table when value is below threshold and otherwise use > RTA_TABLE. > > That should avoid the issue completely. I was talking about what if the kernel does not support the RTA_TABLE attribute. > Thanks! > > -- > Frode Nordahl > >> Cheers, >> >> Eelco >> >>> --- >>> lib/route-table.c | 8 +++++--- >>> 1 file changed, 5 insertions(+), 3 deletions(-) >>> >>> diff --git a/lib/route-table.c b/lib/route-table.c >>> index e7d7a7979..ea56f19c3 100644 >>> --- a/lib/route-table.c >>> +++ b/lib/route-table.c >>> @@ -181,7 +181,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; >>> @@ -195,7 +195,9 @@ 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; >>> + rq_msg->rtm_table = RT_TABLE_UNSPEC; >>> + >>> + nl_msg_put_u32(&request, RTA_TABLE, id); >>> >>> nl_dump_start(&dump, NETLINK_ROUTE, &request); >>> ofpbuf_uninit(&request); >>> @@ -224,7 +226,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 d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev