summaryrefslogtreecommitdiff
path: root/net/ipv6/fib6_notifier.c
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2017-08-03 13:28:19 +0200
committerDavid S. Miller <davem@davemloft.net>2017-08-03 15:36:00 -0700
commite1ee0a5ba35d999caef94d659b4cb842e63aeb68 (patch)
tree92b3fa4c6ff96dce76e87f51dca8bf0bdab90a5b /net/ipv6/fib6_notifier.c
parentdcb18f762f6ac83a6dc9cdc26dd694dcc167beb7 (diff)
ipv6: fib: Dump tables during registration to FIB chain
Dump all the FIB tables in each net namespace upon registration to the FIB notification chain so that the callee will have a complete view of the tables. The integrity of the dump is ensured by a per-table sequence counter that is incremented (under write lock) whenever a route is added or deleted from the table. All the sequence counters are read (under each table's read lock) and summed, prior and after the dump. In case the counters differ, then the dump is either restarted or the registration fails. While it's possible for a table to be modified after its counter has been read, this isn't really a problem. In case it happened before it was read the second time, then the comparison at the end will fail. If it happened afterwards, then we're guaranteed to be notified about the change, as the notification block is registered prior to the second read. 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_notifier.c')
-rw-r--r--net/ipv6/fib6_notifier.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/net/ipv6/fib6_notifier.c b/net/ipv6/fib6_notifier.c
index 298efc678f3b..66a103ef7e86 100644
--- a/net/ipv6/fib6_notifier.c
+++ b/net/ipv6/fib6_notifier.c
@@ -23,12 +23,18 @@ int call_fib6_notifiers(struct net *net, enum fib_event_type event_type,
static unsigned int fib6_seq_read(struct net *net)
{
- return fib6_rules_seq_read(net);
+ return fib6_tables_seq_read(net) + fib6_rules_seq_read(net);
}
static int fib6_dump(struct net *net, struct notifier_block *nb)
{
- return fib6_rules_dump(net, nb);
+ int err;
+
+ err = fib6_rules_dump(net, nb);
+ if (err)
+ return err;
+
+ return fib6_tables_dump(net, nb);
}
static const struct fib_notifier_ops fib6_notifier_ops_template = {