diff options
author | David Ahern <dsa@cumulusnetworks.com> | 2017-01-11 18:42:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-12 15:18:20 -0500 |
commit | 8a430ed50bb1b19ca14a46661f3b1b35f2fb5c39 (patch) | |
tree | 6bc4c1d06a7e1e4f649886d1bf11e307578ea1f9 | |
parent | 994c5483e7f6dbf9fea622ba2031b9d868feb4b9 (diff) |
net: ipv4: fix table id in getroute response
rtm_table is an 8-bit field while table ids are allowed up to u32. Commit
709772e6e065 ("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: c36ba6603a11 ("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>
-rw-r--r-- | net/ipv4/route.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 0fcac8e7a2b2..709ffe67d1de 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2472,7 +2472,7 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, u32 table_id, | |||
2472 | r->rtm_dst_len = 32; | 2472 | r->rtm_dst_len = 32; |
2473 | r->rtm_src_len = 0; | 2473 | r->rtm_src_len = 0; |
2474 | r->rtm_tos = fl4->flowi4_tos; | 2474 | r->rtm_tos = fl4->flowi4_tos; |
2475 | r->rtm_table = table_id; | 2475 | r->rtm_table = table_id < 256 ? table_id : RT_TABLE_COMPAT; |
2476 | if (nla_put_u32(skb, RTA_TABLE, table_id)) | 2476 | if (nla_put_u32(skb, RTA_TABLE, table_id)) |
2477 | goto nla_put_failure; | 2477 | goto nla_put_failure; |
2478 | r->rtm_type = rt->rt_type; | 2478 | r->rtm_type = rt->rt_type; |