net: Set rtm_table to RT_TABLE_COMPAT for ipv6 for tables > 255 [Linux 5.0]

This Linux kernel change "net: Set rtm_table to RT_TABLE_COMPAT for ipv6 for tables > 255" is included in the Linux 5.0 release. This change is authored by Kalash Nainwal <kalash [at] arista.com> on Wed Feb 20 16:23:04 2019 -0800. The commit for this change in Linux stable tree is 97f0082 (patch).

net: Set rtm_table to RT_TABLE_COMPAT for ipv6 for tables > 255

Set rtm_table to RT_TABLE_COMPAT for ipv6 for tables > 255 to
keep legacy software happy. This is similar to what was done for
ipv4 in commit 709772e6e065 ("net: Fix routing tables with
id > 255 for legacy software").

Signed-off-by: Kalash Nainwal <[email protected]>
Signed-off-by: David S. Miller <[email protected]>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/ipv6/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 047c472..ce15dc4 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -4665,7 +4665,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
        table = rt->fib6_table->tb6_id;
    else
        table = RT6_TABLE_UNSPEC;
-   rtm->rtm_table = table;
+   rtm->rtm_table = table < 256 ? table : RT_TABLE_COMPAT;
    if (nla_put_u32(skb, RTA_TABLE, table))
        goto nla_put_failure;

Leave a Reply

Your email address will not be published. Required fields are marked *