]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: fib_rules: Correctly set table field when table number exceeds 8 bits
authorJethro Beekman <jethro@fortanix.com>
Wed, 12 Feb 2020 15:43:41 +0000 (16:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Mar 2020 15:43:31 +0000 (16:43 +0100)
[ Upstream commit d48258912cc24257da78cccd580056899a010501 ]

In 94f813c3b1066768b25c9f611881c57111a34d2a, RT_TABLE_COMPAT was added to
allow legacy software to deal with routing table numbers >= 256, but the
same change to FIB rule queries was overlooked.

Signed-off-by: Jethro Beekman <jethro@fortanix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/core/fib_rules.c

index dd220ce7ca7ab2dc81aec523055ea1ae0da5a1eb..bb11fc87bbaef121d6901a527abb583a1ab34722 100644 (file)
@@ -967,7 +967,7 @@ static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule,
 
        frh = nlmsg_data(nlh);
        frh->family = ops->family;
-       frh->table = rule->table;
+       frh->table = rule->table < 256 ? rule->table : RT_TABLE_COMPAT;
        if (nla_put_u32(skb, FRA_TABLE, rule->table))
                goto nla_put_failure;
        if (nla_put_u32(skb, FRA_SUPPRESS_PREFIXLEN, rule->suppress_prefixlen))