Skip to content

Commit 40e7c72

Browse files
David Aherngregkh
authored andcommitted
net: ipv4: fix table id in getroute response
[ Upstream commit 8a430ed50bb1b19ca14a46661f3b1b35f2fb5c39 ] rtm_table is an 8-bit field while table ids are allowed up to u32. Commit 709772e ("net: Fix routing tables with id > 255 for legacy software") added the preference to set rtm_table in dumps to RT_TABLE_COMPAT if the table id is > 255. The table id returned on get route requests should do the same. Fixes: c36ba66 ("net: Allow user to get table id from route lookup") Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2e84b8c commit 40e7c72

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/ipv4/route.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2430,7 +2430,7 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, u32 table_id,
24302430
r->rtm_dst_len = 32;
24312431
r->rtm_src_len = 0;
24322432
r->rtm_tos = fl4->flowi4_tos;
2433-
r->rtm_table = table_id;
2433+
r->rtm_table = table_id < 256 ? table_id : RT_TABLE_COMPAT;
24342434
if (nla_put_u32(skb, RTA_TABLE, table_id))
24352435
goto nla_put_failure;
24362436
r->rtm_type = rt->rt_type;

0 commit comments

Comments
 (0)