summaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_trie.c
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2019-12-14 17:53:13 +0200
committerDavid S. Miller <davem@davemloft.net>2019-12-16 16:14:42 -0800
commit20d1565203e68cd32d5db3e293e7323173ad7a0d (patch)
tree0fd7393fd2a86744041455f2db18946f585e6b26 /net/ipv4/fib_trie.c
parent525bc345fcbc6f0d58977452999dd18a15dc0e9b (diff)
downloadlinux-20d1565203e68cd32d5db3e293e7323173ad7a0d.tar.gz
linux-20d1565203e68cd32d5db3e293e7323173ad7a0d.tar.bz2
linux-20d1565203e68cd32d5db3e293e7323173ad7a0d.zip
ipv4: Only Replay routes of interest to new listeners
When a new listener is registered to the FIB notification chain it receives a dump of all the available routes in the system. Instead, make sure to only replay the IPv4 routes that are actually used in the data path and are of any interest to the new listener. Signed-off-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r--net/ipv4/fib_trie.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index c23be49ca51c..3f2ff97618ec 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2080,6 +2080,7 @@ static int fib_leaf_notify(struct key_vector *l, struct fib_table *tb,
struct netlink_ext_ack *extack)
{
struct fib_alias *fa;
+ int last_slen = -1;
int err;
hlist_for_each_entry_rcu(fa, &l->leaf, fa_list) {
@@ -2099,6 +2100,16 @@ static int fib_leaf_notify(struct key_vector *l, struct fib_table *tb,
fa, extack);
if (err)
return err;
+
+ if (fa->fa_slen == last_slen)
+ continue;
+
+ last_slen = fa->fa_slen;
+ err = call_fib_entry_notifier(nb, FIB_EVENT_ENTRY_REPLACE_TMP,
+ l->key, KEYLENGTH - fa->fa_slen,
+ fa, extack);
+ if (err)
+ return err;
}
return 0;
}