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

Message ID ec5c8c2f-34c6-bd70-7f61-7ed14b358d9d@fortanix.com
State Accepted
Delegated to: David Miller
Headers show
Series
  • net: fib_rules: Correctly set table field when table number exceeds 8 bits
Related show

Commit Message

Jethro Beekman Feb. 12, 2020, 3:43 p.m. UTC
In 709772e6e06564ed94ba740de70185ac3d792773, 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>
---
 net/core/fib_rules.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Feb. 17, 2020, 2:39 a.m. UTC | #1
From: Jethro Beekman <jethro@fortanix.com>
Date: Wed, 12 Feb 2020 16:43:41 +0100

> In 709772e6e06564ed94ba740de70185ac3d792773, 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>

Applied and queued up for -stable.

Patch
diff mbox series

diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 3e7e152..bd7eba9 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -974,7 +974,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))