Skip to content

Commit 8a430ed

Browse files
David Aherndavem330
authored andcommitted
net: ipv4: fix table id in getroute response
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 994c548 commit 8a430ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/route.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2472,7 +2472,7 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, u32 table_id,
24722472
r->rtm_dst_len = 32;
24732473
r->rtm_src_len = 0;
24742474
r->rtm_tos = fl4->flowi4_tos;
2475-
r->rtm_table = table_id;
2475+
r->rtm_table = table_id < 256 ? table_id : RT_TABLE_COMPAT;
24762476
if (nla_put_u32(skb, RTA_TABLE, table_id))
24772477
goto nla_put_failure;
24782478
r->rtm_type = rt->rt_type;

0 commit comments

Comments
 (0)