diff options
author | Ido Schimmel <idosch@mellanox.com> | 2017-08-03 07:28:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-03 18:35:59 -0400 |
commit | e3ea973159d53559c5ae9a9dbc824da9aba6cac0 (patch) | |
tree | ab5d466ecd8c66c880b490069e15ba213ede6949 /net/ipv6/fib6_rules.c | |
parent | 1b2a4440858857f2f93bb2ec5bb3a60f4fcc25be (diff) |
ipv6: fib_rules: Check if rule is a default rule
As explained in commit 3c71006d15fd ("ipv4: fib_rules: Check if rule is
a default rule"), drivers supporting IPv6 FIB offload need to be able to
sanitize the rules they don't support and potentially flush their
tables.
Add an IPv6 helper to check if a FIB rule is a default rule.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/fib6_rules.c')
-rw-r--r-- | net/ipv6/fib6_rules.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index ec849d88a662..ef1fcee6bf16 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
@@ -29,6 +29,26 @@ struct fib6_rule { | |||
29 | u8 tclass; | 29 | u8 tclass; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | static bool fib6_rule_matchall(const struct fib_rule *rule) | ||
33 | { | ||
34 | struct fib6_rule *r = container_of(rule, struct fib6_rule, common); | ||
35 | |||
36 | if (r->dst.plen || r->src.plen || r->tclass) | ||
37 | return false; | ||
38 | return fib_rule_matchall(rule); | ||
39 | } | ||
40 | |||
41 | bool fib6_rule_default(const struct fib_rule *rule) | ||
42 | { | ||
43 | if (!fib6_rule_matchall(rule) || rule->action != FR_ACT_TO_TBL || | ||
44 | rule->l3mdev) | ||
45 | return false; | ||
46 | if (rule->table != RT6_TABLE_LOCAL && rule->table != RT6_TABLE_MAIN) | ||
47 | return false; | ||
48 | return true; | ||
49 | } | ||
50 | EXPORT_SYMBOL_GPL(fib6_rule_default); | ||
51 | |||
32 | struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, | 52 | struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, |
33 | int flags, pol_lookup_t lookup) | 53 | int flags, pol_lookup_t lookup) |
34 | { | 54 | { |