* [PATCH] net: ipv4: fix table id in getroute response
@ 2017-01-11 23:42 David Ahern
2017-01-12 20:18 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: David Ahern @ 2017-01-11 23:42 UTC (permalink / raw)
To: netdev; +Cc: David Ahern
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>
---
net/ipv4/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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,
r->rtm_dst_len = 32;
r->rtm_src_len = 0;
r->rtm_tos = fl4->flowi4_tos;
- r->rtm_table = table_id;
+ r->rtm_table = table_id < 256 ? table_id : RT_TABLE_COMPAT;
if (nla_put_u32(skb, RTA_TABLE, table_id))
goto nla_put_failure;
r->rtm_type = rt->rt_type;
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] net: ipv4: fix table id in getroute response
2017-01-11 23:42 [PATCH] net: ipv4: fix table id in getroute response David Ahern
@ 2017-01-12 20:18 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-01-12 20:18 UTC (permalink / raw)
To: dsa; +Cc: netdev
From: David Ahern <dsa@cumulusnetworks.com>
Date: Wed, 11 Jan 2017 15:42:17 -0800
> 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>
Good catch, applied and queued up for -stable.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-12 20:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-11 23:42 [PATCH] net: ipv4: fix table id in getroute response David Ahern
2017-01-12 20:18 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).