[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <27c557ac-5905-5004-8264-1ceba0ad76c6@cumulusnetworks.com>
Date: Wed, 15 Mar 2017 09:15:43 -0600
From: David Ahern <dsa@...ulusnetworks.com>
To: Jiri Pirko <jiri@...nulli.us>, netdev@...r.kernel.org
Cc: davem@...emloft.net, idosch@...lanox.com, mlxsw@...lanox.com,
shm@...ulusnetworks.com, kuznet@....inr.ac.ru, jmorris@...ei.org,
yoshfuji@...ux-ipv6.org, kaber@...sh.net, lorenzo@...gle.com,
mateusz.bajorski@...ia.com
Subject: Re: [patch net-next v2 1/9] net: fib_rules: Check if selector matches
all packets
On 3/15/17 5:05 AM, Jiri Pirko wrote:
> diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
> index b6791d9..4ed475d 100644
> --- a/net/core/fib_rules.c
> +++ b/net/core/fib_rules.c
> @@ -23,6 +23,20 @@ static const struct fib_kuid_range fib_kuid_range_unset = {
> KUIDT_INIT(~0),
> };
>
> +bool fib_rule_matchall(const struct fib_rule *rule)
> +{
> + if (rule->iifindex || rule->oifindex || rule->mark || rule->l3mdev ||
l3mdev should not be in that list. Setting l3mdev is functionally
equivalent to setting rule->table. The difference is that l3mdev means
go get the table from the device. It has no bearing on a 'matchall' intent.
> + rule->tun_id || rule->flags)
> + return false;
> + if (rule->suppress_ifgroup != -1 || rule->suppress_prefixlen != -1)
> + return false;
> + if (!uid_eq(rule->uid_range.start, fib_kuid_range_unset.start) ||
> + !uid_eq(rule->uid_range.end, fib_kuid_range_unset.end))
> + return false;
> + return true;
> +}
> +EXPORT_SYMBOL_GPL(fib_rule_matchall);
> +
> int fib_default_rule_add(struct fib_rules_ops *ops,
> u32 pref, u32 table, u32 flags)
> {
> diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
> index 2892109..7a941a5 100644
> --- a/net/ipv4/fib_rules.c
> +++ b/net/ipv4/fib_rules.c
> @@ -47,6 +47,16 @@ struct fib4_rule {
> #endif
> };
>
> +bool fib4_rule_matchall(const struct fib_rule *rule)
> +{
> + struct fib4_rule *r = (struct fib4_rule *) rule;
Use container_of instead of typecast.
Powered by blists - more mailing lists