net: fib_rules: Correctly set table field when table number exceeds 8 bits

In 709772e6e0, 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>
This commit is contained in:
Jethro Beekman 2020-02-12 16:43:41 +01:00 коммит произвёл David S. Miller
Родитель 0d4597c8c5
Коммит 540e585a79
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -974,7 +974,7 @@ static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule,
frh = nlmsg_data(nlh); frh = nlmsg_data(nlh);
frh->family = ops->family; 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)) if (nla_put_u32(skb, FRA_TABLE, rule->table))
goto nla_put_failure; goto nla_put_failure;
if (nla_put_u32(skb, FRA_SUPPRESS_PREFIXLEN, rule->suppress_prefixlen)) if (nla_put_u32(skb, FRA_SUPPRESS_PREFIXLEN, rule->suppress_prefixlen))