summaryrefslogtreecommitdiff
path: root/include/net/ip_fib.h
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2016-12-03 18:45:07 +0300
committerDavid S. Miller <davem@davemloft.net>2016-12-04 03:29:35 +0300
commitc3852ef7f2f8f75a9f85a864bec1f6f5a3068eea (patch)
tree65da87ee804eacc4e5f6535e1d9bb8927cba244d /include/net/ip_fib.h
parentcacaad11f43aefbbe5fca00af3b9c16e6aee1ba4 (diff)
downloadlinux-c3852ef7f2f8f75a9f85a864bec1f6f5a3068eea.tar.xz
ipv4: fib: Replay events when registering FIB notifier
Commit b90eb7549499 ("fib: introduce FIB notification infrastructure") introduced a new notification chain to notify listeners (f.e., switchdev drivers) about addition and deletion of routes. However, upon registration to the chain the FIB tables can already be populated, which means potential listeners will have an incomplete view of the tables. Solve that by dumping the FIB tables and replaying the events to the passed notification block. The dump itself is done using RCU in order not to starve consumers that need RTNL to make progress. The integrity of the dump is ensured by reading the FIB change sequence counter before and after the dump under RTNL. This allows us to avoid the problematic situation in which the dumping process sends a ENTRY_ADD notification following ENTRY_DEL generated by another process holding RTNL. Callers of the registration function may pass a callback that is executed in case the dump was inconsistent with current FIB tables. The number of retries until a consistent dump is achieved is set to a fixed number to prevent callers from looping for long periods of time. In case current limit proves to be problematic in the future, it can be easily converted to be configurable using a sysctl. 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 'include/net/ip_fib.h')
-rw-r--r--include/net/ip_fib.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 6c67b9391fc0..5f376af377c7 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -221,7 +221,8 @@ enum fib_event_type {
FIB_EVENT_RULE_DEL,
};
-int register_fib_notifier(struct notifier_block *nb);
+int register_fib_notifier(struct notifier_block *nb,
+ void (*cb)(struct notifier_block *nb));
int unregister_fib_notifier(struct notifier_block *nb);
int call_fib_notifiers(struct net *net, enum fib_event_type event_type,
struct fib_notifier_info *info);