diff options
author | Ido Schimmel <idosch@mellanox.com> | 2017-08-03 13:28:18 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-04 00:36:00 +0200 |
commit | dcb18f762f6ac83a6dc9cdc26dd694dcc167beb7 (patch) | |
tree | fad7aaa2d2aac7cb2db4908987cf0da97e9c25a7 /net/ipv6/fib6_rules.c | |
parent | ipv6: fib: Add in-kernel notifications for route add / delete (diff) | |
download | linux-dcb18f762f6ac83a6dc9cdc26dd694dcc167beb7.tar.xz linux-dcb18f762f6ac83a6dc9cdc26dd694dcc167beb7.zip |
ipv6: fib_rules: Dump rules during registration to FIB chain
Allow users of the FIB notification chain to receive a complete view of
the IPv6 FIB rules upon registration to the chain.
The integrity of the dump is ensured by a per-family sequence counter
that is incremented (under RTNL) whenever a rule is added or deleted.
All the sequence counters are read (under RTNL) and summed, prior and
after the dump. In case the counters differ, then the dump is either
restarted or the registration fails.
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 | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index ef1fcee6bf16..2f29e4e33bd3 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c @@ -14,6 +14,7 @@ */ #include <linux/netdevice.h> +#include <linux/notifier.h> #include <linux/export.h> #include <net/fib_rules.h> @@ -49,6 +50,16 @@ bool fib6_rule_default(const struct fib_rule *rule) } EXPORT_SYMBOL_GPL(fib6_rule_default); +int fib6_rules_dump(struct net *net, struct notifier_block *nb) +{ + return fib_rules_dump(net, nb, AF_INET6); +} + +unsigned int fib6_rules_seq_read(struct net *net) +{ + return fib_rules_seq_read(net, AF_INET6); +} + struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6, int flags, pol_lookup_t lookup) { |