2020-02-12 15:45:10

by Jethro Beekman

[permalink] [raw]
Subject: [PATCH] net: fib_rules: Correctly set table field when table number exceeds 8 bits

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 <[email protected]>
---
net/core/fib_rules.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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))
--
2.7.4


2020-02-17 02:39:24

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] net: fib_rules: Correctly set table field when table number exceeds 8 bits

From: Jethro Beekman <[email protected]>
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 <[email protected]>

Applied and queued up for -stable.